ID: 29283 Comment by: alex at avannaproductions dot com Reported By: divisor at ad69 dot com Status: Open Bug Type: MySQL related Operating System: FreeBSD 4.10 PHP Version: 5.0.0 New Comment:
I'll chime in as another voice of reason: this should be fixed before 5.0.1. At the moment, prepared statements are basically useless, as half the time they give this error and fail to return any data. I'm on MacOS X and Apache 2, with the same problem. Previous Comments: ------------------------------------------------------------------------ [2004-07-25 18:33:46] dev at edwinchu dot info Hi, I have got the same problem. I am using PHP5 release with MySQL4.1.3-beta. The code is simple: $mysqli = new mysqli(); // connected successfully $stmt = $mysqli->prepare("SOME VALID QUERY"); $stmt->execute(); // No problem here $mysqli2 = $mysqli; $mysqli2->query("THE SAME QUERY"); // Still OK $stmt2 = $mysqli2->prepare("THE SAME QUERY"); $stmt2->execute(); The last line failed and returning "Warning: Statement isn't valid anymore in xxx". ------------------------------------------------------------------------ [2004-07-21 16:24:11] divisor at ad69 dot com it caused randomly on all statetments, prepare() was ok but execute() failed: if ($stmt=$DB->prepare("select something from table where name=?")) { $stmt->bind_param('s',$name); $stmt->execute(); // HERE PHP WRITE WARNING // AND STMT COINTAIN NO DATA variables stmt->error, stmt->errno are empty that's strange but after removing lines 182-187 from ext/mysqli/php_mysqli.h: if (!strcmp((char *)__name, "mysqli_stmt")) {\ if (!((MYSQL_STMT *)__ptr)->mysql) {\ php_error(E_WARNING, "Statement isn't valid anymore");\ RETURN_NULL();\ }\ }\ } it started working without any problems. but of course this 'hack' of php code isn't good ;) ------------------------------------------------------------------------ [2004-07-21 10:03:11] [EMAIL PROTECTED] Please provide a short script, where we can see where the error occurs. Also try to catch the errormessages via ->stmt_error/errno properties. ------------------------------------------------------------------------ [2004-07-20 20:17:08] divisor at ad69 dot com sorry I've accidently provided wrong mysql version of course it's mysql 4.1.3 beta ------------------------------------------------------------------------ [2004-07-20 20:15:49] divisor at ad69 dot com Description: ------------ The problem is in CLI as well as in apache module I have mysql 4.3.1 and php 5.0.0 installed, use mysqli interface to work with mysql. In different scripts in different places (mostly random) I get the following error: 1) Warning message: Statement isn't valid anymore 2) Statetment result contains no data Reproduce code: --------------- appears in randomly different places, all like this: ($DB is mysqli object) if ($stmt=$DB->prepare("select something from table where name=?")) { $stmt->bind_param('s',$name); $stmt->execute(); Expected result: ---------------- The same code worked fine on the second server running FreeBSD 5.2.1 without any problems. The main difference between 2 servers I think that the first one (where bug appears) is a productional server with many requests to apache/php/mysql, the second one is a development server with no usage. Actual result: -------------- get Warning: Statement isn't valid anymore message and statetment isn't executed ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29283&edit=1