How to bind named parameters with PDO data-type

Im using PDO in PHP and I need to know how to bind my named parameters to a PDO data-type since PDO just reads my parameter as a string value in default when i need it to be an integer. This is my code $statement = self::connect()->prepare($q...
more »

2017-10-02 17:10 (0) Answers

Writing to 4D using PDO

I am having success reading from 4D using PDO, but not writing to it. When I try to Insert values into the database I get the following error: SQLSTATE[HY000]: General error: 1248 Failed to execute statement. Here is my code: <?php $dsn =...
more »

2017-09-27 23:09 (1) Answers

How to fill combo box in a td of a table

I want to retrieve some data from the database and show them in a table, i need to make one field Order_Status to be as a combo box, its data is filled from another table and to add in the beginning of the combo the result of the row returned from th...
more »

2017-09-27 21:09 (1) Answers

PDO Insert values from subarrays

array(2) { [0]=> array(1) { ["url_id"]=> string(2) "45" } [1]=> array(1) { ["h"]=> string(1) "3" } } echo $column_list = join(',', $items); ... This PDO Insert Array Using Key As Column Name helps me inserti...
more »

2017-09-27 15:09 (0) Answers

PHP PDO Session redirecting me to login page

I am trying to improve my skills in PHP. I came from PHP procedural and shifting to PHP using PDO which will make my web application more secured to prevent SQL Injections or XSS attacks. I created a login form that is working fine that the user can ...
more »

2017-09-27 02:09 (1) Answers

Select statement with where clause Like in array

I know how to perform an SQL LIKE % query for a single value like so: $sql = "SELECT * FROM Farmers WHERE Available_products LIKE ('%Bananas%')"; but how do I do this if the search terms for my LIKE comes from an array? For example, let's say we ha...
more »

2017-09-26 20:09 (3) Answers

How can I use GROUP_CONCAT with multiple values?

I want to get some data via php from my SQL database: GROUP_CONCAT(DISTINCT SEPARATOR ",") AS cats this gives me a list: sam, john, joe I get some other data like this: GROUP_CONCAT(DISTINCT SEPARATOR ",") AS cat_ids here I g...
more »

2017-09-26 15:09 (2) Answers