260 questions
1
vote
0
answers
42
views
The bound variable does not change after execute() per example #5 PDO Stored Procedures in the PHP Documentation, [duplicate]
I've been doing what I'm about to explain using ASP classic and ASP.Net with MSSQL Server for all that time and it works beautifully!
Please, read carefully. Example #5 comes from here: https://www....
-2
votes
1
answer
51
views
Pass NULL if bindParam() or bindValue() having empty variable [duplicate]
I have been struggling for 3 days but cannot get a simple solution.
$asup = $connection->prepare('
update company_assign set
...
0
votes
0
answers
115
views
PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
I'm new in Stackoverflow and I'm sorry if I might not be clear with my question.
I don't understand what's wrong in my code and I would like to have your help. This is the php code snippet:
$giorno = &...
2
votes
1
answer
128
views
Is there any disadvantage to using the splat "..." operator to inject an array of variables into bind_param() in PHP?
I've been trying to streamline how I write my MySQLi code with PHP after learning more about SQL injection and safe coding with bind_param. I wrote a function that can estimate what the "...
0
votes
0
answers
30
views
PHP prepared statement with dynamic get variables [duplicate]
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 ...
0
votes
0
answers
26
views
MySQLi PHP - bind_param problem - No data supplied/Number of elements in type definition [duplicate]
I have an odd problem with bind_param() for mysqli in PHP.
Here's the code:
$q = <<<SQL
INSERT INTO customers (name, company, email)
VALUES (?, ?, ?)
SQL;
$...
0
votes
1
answer
68
views
What is the proper way to bind_parameters when using UPDATE and CASE WHEN? [duplicate]
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 ...
0
votes
0
answers
33
views
PHP PDO BindParam() not works [duplicate]
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 = ...
0
votes
2
answers
814
views
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 (...
0
votes
0
answers
92
views
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 ...
0
votes
0
answers
25
views
PDO bindParam() Multiple insert foreach [duplicate]
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
...
0
votes
0
answers
26
views
Why bind_param fails? [duplicate]
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 ...
0
votes
0
answers
73
views
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 )
$...
0
votes
0
answers
111
views
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 ...
1
vote
0
answers
31
views
php PDO bindParam using empty string [duplicate]
I'm not sure about this behaviour.
$query = 'INSERT INTO XXX (row1) VALUES (:myparam)';
$stmt = $mycon->prepare($query);
$stmt->bindParam(':myparam','',PDO::PARAM_STR);
above code will fail at ...