[PHP] mysqli_stmt::bind_param(), Number of variables doesn't match number of parameters in prepared statement

2006-06-30 Thread gg15
I wanted to use the prepared statements of mysqli, but the following 
problem occured:


If I just use one parameter everything works fine
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Datum) 
VALUES (?, NOW())');

$prep->bind_param('s', $this->Von);

but if I try to use two
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Betreff, 
Datum) VALUES (?, ?, NOW())');

echo $prep->param_count; // echos 2
$prep->bind_param('ss', $this->Von, $this->Betreff);

I get an error
Warning: mysqli_stmt::bind_param() : Number of variables doesn't
match number of parameters in prepared statement in ...


Am I doing something wrong or is it a bug or whatever?

php version is 5.1.4 on winXP



Best regards, Ulrich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqli_stmt::bind_param(), Number of variables doesn't match number of parameters in prepared statement

2006-07-01 Thread gg15

No it is not empty. But I think I found the bug in the bugtracker...

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

Sorry, but with such a bug in the feature nobody can use it. Even if I 
am able to fix it on my local machine (but actually I was not able to do 
so until now), whats about my webspace? Maybe I do not have access to 
the console, so I cannot exchange any libs...


The prepared statements are definitely a nice-to-have, but under this 
conditions, stay away from them!


I will use mysqli_real_escape_string, like I have done with the old 
functions and just hope for some slight improve in performance ... but I 
think not even this is given with the new extension.
Sorry, but I have not seen much of the "improved" in the functions 
(beside OOP ^^).



Best Regards, Ulrich



chris smith schrieb:

On 7/1/06, gg15 <[EMAIL PROTECTED]> wrote:

I wanted to use the prepared statements of mysqli, but the following
problem occured:

If I just use one parameter everything works fine
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Datum)
VALUES (?, NOW())');
$prep->bind_param('s', $this->Von);

but if I try to use two
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Betreff,
Datum) VALUES (?, ?, NOW())');
echo $prep->param_count; // echos 2
$prep->bind_param('ss', $this->Von, $this->Betreff);

I get an error
Warning: mysqli_stmt::bind_param() : Number of variables doesn't
match number of parameters in prepared statement in ...


Is $this->Betreff empty? I wonder if its having issues with an empty var..



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php