471,084 Members | 974 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,084 software developers and data experts.

mysqli-trouble with mysql5

Hi;
I am using the mysqli-extension on all my database queries.
Everything worked just fine when I used MySQL 4, but when the database was
upgraded to MySQL 5 (5.0.22), I got a strange error.
Here is an example:

function example(){
global $table, $mysqli;
$min = 2;
$stmt = mysqli_prepare($mysqli, "SELECT SUM(Id) FROM $table WHERE
Id>?");
if ($stmt){
mysqli_bind_param($stmt, 'i', $min);
mysqli_execute($stmt);
mysqli_bind_result($stmt, $number);
mysqli_stmt_close($stmt);
}
else echo "failure";
}

This worked fine with mysql4, but with mysql5 i get a "proxy server error".

BUT: By removing SUM from the query, everything works fine:
$stmt = mysqli_prepare($mysqli, "SELECT Id FROM $table WHERE Id>?");

(but of course the query gives me not an interesting result).

SO: It seems that SUM messes things up, but there are noe good reasons for
it as I can see.
When I comment the line
// mysqli_bind_result($stmt, $number);
i do not get the error.

I use PHP 5.0.4, and MySQL 5.0.22. I use a tomcat server.

Any suggestions...?
Nov 23 '06 #1
0 1224

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Roy Shaw | last post: by
2 posts views Thread by ojorus | last post: by
12 posts views Thread by davids58 | last post: by
2 posts views Thread by Curtis | last post: by
13 posts views Thread by Schmidty | last post: by
21 posts views Thread by Daz | last post: by
2 posts views Thread by webcm123 | last post: by
2 posts views Thread by Michael | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.