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
1 answer

bind_param number of elements doesn't match number of element array

hello i've got a question about bind_param every code is works but not this one...probably dumb question.. $key = "`".implode("`, `",array_keys($notifikasi))."`"; echo $value = "'".implode("', '",array_values($notifikasi))."'"; $query =…
faddi
  • 71
  • 1
  • 10
0
votes
2 answers

Blank Page after Prepared Statement PHP

After I used prepared statements to reduce the risk of SQL injection, the button click makes the page blank. I could not find any errors in my code. What is causing the page to go blank and how can I prevent it from happening?…
apaul
  • 308
  • 3
  • 13
0
votes
2 answers

Call to a member function bind_param() on a non-object

The bind parameter function, bind_param() is considered a non object and keeps throwing errors that hurt my head as i'm new to the PHP thing. The code used to connect to the database was originally throwing errors, even though I copied it from my…
Isaac Manzi
  • 36
  • 1
  • 9
0
votes
0 answers

Fatal error: Call to a member function bind_param() on a non-object, JSON Array

I've searched this here and on the internet but can't find a solution. I'm posting a JSON array like : [{"phone_number":"+12345678"}, {"phone_number":"+23456789"}, {"phone_number":"34567890"}, {"phone_number":"45678901"} etc... etc... Here's…
CHarris
  • 2,693
  • 8
  • 45
  • 71
0
votes
0 answers

PDOException: SQLSTATE[]: <>: 0 (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254)

Trying to write to oracle calling a procedure using PHP but I get an unknown error. $sth = $dbh->prepare(" begin :RESULT := STUD.IWS001FUN(:x_year, :x_stno, :x_bc, :x_bld, :x_status); end; "); // Bind the output parameter …
0
votes
1 answer

Send a value of variable in android studio to php

I got problem to pass the value inside the variable of Android Studio to the php code. In this case I want to pass the value inside the variable "group_id" in Message.java to the DbOperation.php. That means at the end, the function "getMessages"…
ping94
  • 67
  • 1
  • 1
  • 7
0
votes
1 answer

MySQL using Bind_Param and ON DUPLICATE KEY

I have a table called test_favoriteswhere users are able to add something to favorites. I use this SQL-function, but get this error: call to a member function bind_param() on boolean in line (bind_param-line) $sql = $conn->prepare("INSERT INTO…
user5827260
0
votes
1 answer

Possible to pass string of variables: to stmt->bind_param()?

Im in a situation where a mysqli query is created dynamically from $_GET values, which are always changing depending on the custom searches made . Would it be possible to pass a correctly formatted (and dynamically created) string to show the…
Maximilian Travis
  • 311
  • 1
  • 3
  • 12
0
votes
1 answer

Getting error with bind_param in php

I'm getting the error Fatal error: Uncaught Error: Call to a member function bind_param() on boolean. I have tried all I know, and I cannot get it to work. This is what I have so far: $db = "THIS IS CORRECT, TRUST ME. I HAVE TESTED IT :)"; $team =…
Francisco F.
  • 111
  • 1
  • 3
  • 14
0
votes
1 answer

What happens when you filter input in PDO prepared statement and the STR is in the form of an interger?

This may be a little elementary for some, but in something like the following statement what would happen if the string was an integer (e.x 007 as in the movie): $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12); If colour was '007' would…
Magic
  • 67
  • 5
0
votes
2 answers

Insert empty value using Bindparam without error Incorrect Integer value

I want to insert some data into my MySql table using PDO. If it's not empty it will have Integer datatype so i use PDO::PARAM_INT, but the problem is this data is not required so sometimes it's empty. It make me have an error: PDOException:…
Ying
  • 1,282
  • 4
  • 19
  • 34
0
votes
1 answer

PHP query not working with bindParam but the query does work in itself

I'm trying to insert information insto a mySQL database and I get the WSOD and this error: PHP Fatal error: Call to a member function bindParam() on a non-object ... This is the code: try { $conectar1 = new PDO('mysql:host='.HOST.';…
Rosamunda
  • 14,620
  • 10
  • 40
  • 70
0
votes
0 answers

PHP PDO bind param

I've done this function to insert a new product: function insertProduct($product) { $db = connect_db(); $columnsNames = $paramsNames = ""; foreach ($product as $key => $value) { $columnsNames .= "$key,"; $paramsNames .=…
ProtoTyPus
  • 1,272
  • 3
  • 19
  • 40
0
votes
2 answers

PHP - Message Queue - PDO bindParam using extract as reference

I've run into an issue and getting this to work correctly is melting my brain. I'm wondering if anyone out there can point me in the right direction. Basically, I'm using a multi threaded message queue handler to insert message values into a…
0
votes
0 answers

Using bind_param() on WHERE ? =? (Using MySQLi)

Using Mysqli, I have the following function: public static function selectBy(Database $database, $columnName, $value){ $connection = $database->getConnection(); $stmt = $connection->prepare(' SELECT * FROM `Users` WHERE ? = ?;'); …
StackMaster
  • 359
  • 1
  • 5
  • 22