jugdish114 Posted October 18, 2013 Share Posted October 18, 2013 I am having an issue where the output from a MySQL stored procedure is not handled correctly, when there is NO resultset, as opposed to a NULL resultset. For example: 1) select * from myTable; //this works, there are 0,1, multiple records returned 2) select * from myTable where 1=2; //this works, there are 0 records returned in a NULL resultset 3) set user_level = 'user'; if user_level = 'admin' then select * from myTable; //this never hits end if; There is an error in #3, the query is never touched, so NO resultset is returned. This is different from what happens in example #2, where a resultset is returned, it is just NULL. My code looks like this: if ( ($result = $mysqli_conn->query($SQL)) == false ) { printf("Invalid query: %s\nWhole query: %s\n", $mysqli_conn->error, $SQL); } else { while ($myrow = $result->fetch_array(MYSQLI_ASSOC)) { ... do something here } Any thoughts on how to handle this cleanly? Thanks all, Frank Quote Link to comment Share on other sites More sharing options...
fenway Posted October 27, 2013 Share Posted October 27, 2013 Start by posting the actual code for the SP. 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.