Bug #31037 [Com]: MySQLi - bind_param

From: Date: Tue, 13 May 2014 20:32:17 +0000
Subject: Bug #31037 [Com]: MySQLi - bind_param
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185810@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=31037&edit=1

 ID:                 31037
 Comment by:         rui dot calsaverini at gmail dot com
 Reported by:        php at trafex dot nl
 Summary:            MySQLi - bind_param
 Status:             No Feedback
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Fedora core 1
 PHP Version:        5CVS-2005-04-26
 Assigned To:        georg
 Block user comment: N
 Private report:     N

 New Comment:

This bug is rendering mysqli unusable to me! I can't even get it to accept something like this:

$stmt = $link->prepare("SELECT ?, ?");		
								  
$stmt->bind_param("i", $this->ckey);
$stmt->bind_param("i", $this->ckey);
		  	
$stmt->execute();


I get the same  "Number of variables doesn't match number of parameters in prepared
statement in..." warning.
Anybody found a solution? Is this API marginally usable?


Previous Comments:
------------------------------------------------------------------------
[2011-04-03 13:24:03] solve at solve dot com

Probleme SOLVED !
Look at my post above (from noadress at noadress dot com)

------------------------------------------------------------------------
[2011-04-03 13:20:47] noadress at noadress dot com

I've had the same problem.. and my libs were new.

I had: 
$sqlquery = "UPDATE $table SET title='?', msg='?', date='?' WHERE
ID='?'";
.......
$stmt->bind_param('sssi', $_SESSION['tit'], $_SESSION['tex'],
$_SESSION['dat'], 
$_SESSION['id']); 

--> ERROR - Number of variables doesn't match number of parameters in prepared 
statement


--> SOLVE
Remove the '' before and after the ?
-> "UPDATE $table SET title=?, msg=?, date=? WHERE ID=?"
and now he did the update ;)

have fun

------------------------------------------------------------------------
[2007-11-28 15:51:28] catalin dot tanasescu at filipnet dot ro

I know this is old but ...I had the same problem.
resolved it by adding after each    $stmt->execute(); this
   $stmt->store_result();

very strange ...
hope this helps someone

------------------------------------------------------------------------
[2006-09-11 15:21:16] xpertindia at yahoo dot com

oops correction - 

I got it workig as follows -

$vsql1 = "select userid, email from re_users u where email = ? and
password = ?";

$preparedstatement1 = $gvdblink->prepare($vsql1);
$preparedstatement1->bind_param('ss', $bv1, $bv2);

It is funny that when I put an * (asterix) I get a  warning/error. It is
sad that we have to specify every column we need to retreive.

This fails -

$vsql1 = "select * from re_users u where email = ? and password = ?";

------------------------------------------------------------------------
[2006-09-11 15:19:16] xpertindia at yahoo dot com

I got it workig as follows -

$vsql1 = "select userid, email from re_users u where email = ? and password = ?";

$preparedstatement1 = $gvdblink->prepare($vsql1);
mysqli_stmt_bind_param($preparedstatement1, "ss", $bv1, $bv2)

It is funny that when I put an * (asterix) I get a  warning/error. It is sad that we have to specify
every column we need to retreive.

This fails -

$vsql1 = "select * from re_users u where email = ? and password = ?";

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=31037


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=31037&edit=1


Thread (24 messages)

« previous php.bugs (#185810) next »