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 Link to comment https://forums.phpfreaks.com/topic/222849-question-confused-with-mysqli_stmt_store_result-and-mysqli_stmt_fetch/ 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 Link to comment https://forums.phpfreaks.com/topic/222849-question-confused-with-mysqli_stmt_store_result-and-mysqli_stmt_fetch/#findComment-1152364 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. Link to comment https://forums.phpfreaks.com/topic/222849-question-confused-with-mysqli_stmt_store_result-and-mysqli_stmt_fetch/#findComment-1152410 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.