Questions tagged [bindparam]

In PHP, binds a variable to a corresponding named or question mark parameter in the SQL statement that was used to prepare the statement.

Binds a PHP variable to a corresponding named or question mark parameter in the SQL statement that was used to prepare the statement. Unlike PDOStatement::bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement::execute() is called.

public bool PDOStatement::bindParam ( mixed $parameter , mixed &$variable [, int $data_type = PDO::PARAM_STR [, int $length [, mixed $driver_options ]]] )

Reference

PHP Documentation

267 questions
0
votes
0 answers

PHP prepared statement with dynamic get variables

I'm trying to create a feature where users can chose which columns in the database they would like to filter on. Filter options are from_date, to_date, reference, offset, status and customer_id which are passed in the URL like so:…
Jasper
  • 1
0
votes
0 answers

MySQLi PHP - bind_param problem - No data supplied/Number of elements in type definition

I have an odd problem with bind_param() for mysqli in PHP. Here's the code: $q = <<QP( $q, …
Simon
  • 1,385
  • 1
  • 11
  • 20
0
votes
1 answer

What is the proper way to bind_parameters when using UPDATE and CASE WHEN?

I have never done a bind_param() on a key/value table. So, I'm not sure that CASE WHEN can even be applied this way. The variable column holds all those "cust_xxx" items while their actual values sit in the value column. Also, I wasn't sure if $who…
0
votes
0 answers

PHP PDO BindParam() not works

I have a web service that receives a JSON string with multiple places. The first thing I do is put this JSON in an array, which I have checked and all its elements are correct. $json = file_get_contents('php://input'); $obj =…
wiki
  • 299
  • 4
  • 16
0
votes
2 answers

Erreur !: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

I'm working on a program to update the user's password with PHP/MySQL. The table is titled 'utilisateurs' and contains several fields: • numero (auto-increment); • identifiant (user ID); • motdepasse (password). The user has to provide the actual…
0
votes
0 answers

Confused about why db2_bind_param is not doing anything

So I am trying to edit my DB, which has HTML stored in it. I am trying to replace the max-width:auto; css styling with a max-width:100%;. I figured the best way would be to use db2_bind_param in order to avoid sql errors, and safely enter my data…
BoogaBooga
  • 147
  • 10
0
votes
0 answers

PDO bindParam() Multiple insert foreach

I am having trouble using PDO bind param when using foreach. There is an array in which the key is a named parameter ':param' = array(data=>$param, type=> PDO::PARAM_INT) [0] => Array ( [order_id] => Array ( …
0
votes
0 answers

Why bind_param fails?

SQL statement works perfectly on db, param value evaluates correctly. Connection works (there's a previous db request that has successfully closed), but bind_param fails. $sql3 = "SELECT s.teacher AS teacher, rL.classTotal …
Enedc
  • 3
  • 2
0
votes
0 answers

Bind params in multiple foreach loops

How can I bind params in multiple foreach loops? With ? SQL output is wrong '%term%'SELECT * FROM `user` WHERE (LOWER(`name`) LIKE '\\' ESCAPE '%second_term%') OR (LOWER(`name`) LIKE '\\' ESCAPE ) $attributes = $this->attributes; $searchTerms =…
Arthur
  • 1
  • 2
  • 1
0
votes
0 answers

PDO JOIN while binding IN on two tables with related data

This might be less complicated than I'm making it, but I'm stuck. I have two tables with columns that have related data that I'd like to join when the user searches for one or two terms. Example tables would look like this, using placeholder…
Niwa
  • 67
  • 1
  • 5
0
votes
1 answer

Parent - child table in PHP PDO SQLite under transaction - No error but it doesn't work

Good morning, I wrote the code below that it's running on PHP with PDO and SQLite under transaction. Inexplicably it does not go into error but it does not even write the second table which results with all the fields of the records at null. Could…
Tonky75
  • 133
  • 1
  • 7
0
votes
1 answer

Query execute() after bind_param not working

Basically am sending a user through a post request from postman to my PHP script attached to my site the script is this one
Erraco
  • 138
  • 1
  • 12
0
votes
1 answer

PHP PDO: Invalid character value for cast specification

I am trying to execute a stored procedure with an output variable by passing information through from a form, however, I am receiving the following error when submitting the…
0
votes
0 answers

How to insert DATETIME & BOOLEAN values using MYSQLI parameter binding?

On submission, this is my code: if(isset($_POST['send_money'])) { $date = explode("/",date('d/m/Y/h/i/s')); list($day,$month,$year,$hour,$min,$sec) = $date; $transaction_id = 'GMT'. $year .'.'.$day.$month.'.'.$hour . $min.$sec; …
0
votes
0 answers

Insert multiple rows with bindparam

Well , i´ve got a problem with bindparam insertion $sql="INSERT INTO $tabla (value1,value2,value3)"; for($arrays as array){ $sql.=",($array,:bind2,:bind3)" } $stmt=conection::conect()->prepare($sql); $stmt->bindParam(:bind2,…