ID: 31037
Comment by: catalin dot tanasescu at filipnet dot ro
Reported By: php at trafex dot nl
Status: No Feedback
Bug Type: MySQLi related
Operating System: Fedora core 1
PHP Version: 5CVS-2005-04-26
Assigned To: georg
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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 = ?";
------------------------------------------------------------------------
[2006-05-16 07:36:01] aman dot tur at gmail dot com
I am using WAMP 5 (MySQL 5.0.21 Client 40107, Apache 2 , Windows Server
2003). When i try to execute followint script i get error: Number of
variables doesn't match number of parameters in prepared statement
<?php
$capital=1;
$mysqli=new mysqli('192.168.0.1','root','*','world');
//INIT statement
$stmt=$mysqli->stmt_init();
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
//Create statement for Procedure
$stmt=$mysqli->stmt_init();
if(!$stmt)
{
printf("Error creating Statement: $s\n",$mysqli->error);
exit();
}
$stmt=$mysqli->prepare("Select name from country where Capital =
?");
if(!$stmt)
{
printf("Error creating Statement: %s\n",$mysqli->errno);
printf("Error creating Statement: %s\n",$mysqli->error);
printf("Statement Error: %s\n",$stmt->error);
exit();
}
printf("No of Parameters in Statement: %d
\n",$stmt->param_count);
printf("Client version: %s\n", $mysqli->client_version);
printf("Server version: %s\n", $mysqli->server_version);
//Bind the paremeter values that are to be passed to stored
procedure
//This line gives error
$stmt->bind_param("i",$capital);
//execute the stored procedure
$stmt->execute();
$stmt->bind_result($name);
$stmt->fetch();
printf("Country Name: %s\n", $name);
$stmt->close();
$mysqli->close();
?>
------------------------------------------------------------------------
[2006-04-28 06:33:57] cythrawll at cythnet dot com
I reproduced this (on accident) with php 5.1.2 on MySQL 4.1.14
Slackware 10.2
Client version: 40114 Server version: 40114
------------------------------------------------------------------------
[2006-03-30 20:56:32] droppse at wjh dot harvard dot edu
Updating the mysql client lib's resolved this problem on XP Pro, WAMP.
------------------------------------------------------------------------
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
http://bugs.php.net/31037
--
Edit this bug report at http://bugs.php.net/?id=31037&edit=1