jtorral Posted December 28, 2010 Share Posted December 28, 2010 I have this code that uses mysqli_stmt_store_result and mysqli_stmt_fetch This code does NOT work: $query = "SELECT userid FROM customer LIMIT 1"; $stmt = mysqli_prepare($connectstring, $query); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); mysqli_stmt_bind_result($stmt, $returnedval); mysqli_stmt_close($stmt); This code DOES work: $query = "SELECT userid FROM customer LIMIT 1"; $stmt = mysqli_prepare($connectstring, $query); mysqli_stmt_execute($stmt); mysqli_stmt_bind_result($stmt, $returnedval); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); I have some other code where the mysqli_stmt_store_result($stmt); does work and I thought that was a way of storing the result of the execute. Can someone explain the difference between the two statements. PHP says to always use the store but it does not work. Thanks JT Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 28, 2010 Share Posted December 28, 2010 just a hunch and it is mysql page rather than mysqli BUT call mysql_stmt_store_result() after binding data buffers with mysql_stmt_bind_result() note the order seems to be the issue - source http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-store-result.html Quote Link to comment Share on other sites More sharing options...
jtorral Posted December 29, 2010 Author Share Posted December 29, 2010 Tried that mysqli_stmt_execute($stmt); mysqli_stmt_bind_result($stmt, $nextphotoid); mysqli_stmt_store_result($stmt); //mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); Does not work. Very strange. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.