Linked Questions

5 votes
1 answer
8k views

SOLUTION Change this: foreach($fields as $dbfield => $field) { $value = isset($_POST[$field]) ? 1 : 0; $STH -> bindParam( ':' . $dbfield, $value, PDO::PARAM_INT, 1 ); } to this: ...
oshirowanen's user avatar
16 votes
0 answers
2k views

Possible Duplicate: PDO: bindParam versus bindValue What is a simple explanation of the difference between the two methods of PDOStatement class: PDOStatement->bindParam() and PDOStatement->...
Molfar's user avatar
  • 1,501
0 votes
1 answer
880 views

I'm trying to insert multiple rows using transaction-bind through PHP PDO. Below is my code. $arrkeys = array_keys($this->postItem); $itemqry = "INSERT INTO test_item (itemdate, flditmname, ...
Ravi's user avatar
  • 887
1 vote
1 answer
780 views

This is my php code: public function update($table,$fields_and_values,$condition_field,$condition_field_value) { $query="UPDATE $table SET "; foreach($fields_and_values as $field=>$value) $...
Arman Malekzadeh's user avatar
0 votes
1 answer
463 views

Edit: My issue has been resolved. I did not know or think of bindValue(), that is why I do not think this is a duplicate question. Thanks for the help! I am learning how to register users with PHP ...
Silvio Li's user avatar
  • 139
0 votes
1 answer
436 views

I'm trying to insert values using prepared statements like this: $dbh = new PDO("mysql:host=$hostname;dbname=$database", $username, $password); $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false)...
jonmrich's user avatar
  • 4,373
1 vote
0 answers
392 views

Everyone, I am facing in user.php code. It's showing this error: Notice: Only variables should be passed by reference in line 19 Please check the below code and let me know what I am missing. I ...
Haseeb Kashani's user avatar
0 votes
1 answer
71 views

I have this prepared Statment: $stmt = $dbh->prepare("select * from t where name like :name "); Binding like this works: $p = "%glas%"; $stmt->bindParam(':name', $p ); If I put in the term ...
mica's user avatar
  • 4,418
1 vote
0 answers
96 views

When I AND together two LIKEs in a SQL query, it works fine if I execute it straight on the server. Things get strange when I use PDO to bind variables. On the server the following works as expected ...
Nathan Finch's user avatar
1 vote
0 answers
51 views

I want to use pdo to insert some data in database with a method I created, but it is not returning the right data I used the same code with show and select methods and worked fine, in the foreach of ...
Cristofer Portela's user avatar
1 vote
0 answers
36 views

trying to bind parameters of an sql statement in php using a loop, I get all the parameters equal to the last one. here's my code : $nomTypeFormation = "Types"; $nomFormation = "Nomss"; $...
CHEMSEDDINE HAROUIT's user avatar
0 votes
0 answers
27 views

i have database with this tables users user_id user_name user_email user_password user_reg_date and i have second table user_tokens user_tokens token_id token_user_id ...
Mixmax Makster's user avatar
0 votes
0 answers
27 views

I have the following function that searches a database: public function search($table, $column, $term, $limit = 0, $offset = 0){ $command = "SELECT * FROM `$table`"; $size = 1; //1 is ...
Borif's user avatar
  • 29
0 votes
0 answers
16 views

I'm trying to create a flexible PUT method for my database, in which I pass a JSON = { col1 : val1, col2 : val2, ... } where coln is the table column name and voln is the new value for that column. ...
Nicolás Villar's user avatar
12 votes
2 answers
18k views

I am confuse between these two functions Bindvalue() and BindParam() I read on php.net it does not escape % and _, so be careful when using LIKE. So i think BindValue() is not used when we are using ...
Arun Pratap Singh's user avatar

15 30 50 per page
1
2 3 4 5