note 112353 added to mysqli.query

From: Date: Thu, 06 Jun 2013 03:10:23 +0000
Subject: note 112353 added to mysqli.query
Groups: php.notes 
Request: Send a blank email to php-notes+get-195082@lists.php.net to get a copy of this message
Recently I had puzzling problem when performing DML queries, update in particular, each time a update query is called and then there are some more queries to follow this error will show on the page and go in the error_log: "Fatal error: Exception thrown without a stack frame in Unknown on line 0" The strange thing is that all queries go through just fine so it didn't make much sense: $update = mysqli_query($connection, $query_string); if(!$update){ echo 'Houston we have a problem '.mysqli_error($connection); exit; } In the above example "$update" is "true", mysqli_error() is empty and of course the update operation goes through, however the nasty super cryptic error appears on the page. What makes even less sense to me is how I fixed it - just called "mysqli_free_result" after the update query and the problem was gone, however because mysqli_free_result is not supposed to be called after DML queries (to free what, a boolean? lol) it needs to be wrapped in a try catch block: try{ mysqli_free_result($update); }catch (Exception $e){ //do nothing } So, I don't know why but it seems that when DML queries are responsible for: "Fatal error: Exception thrown without a stack frame in Unknown on line 0" calling "mysqli_free_result" after the query seems to be fixing the issue ---- Server IP: 87.124.126.49 Probable Submitter: 86.6.134.179 ---- Manual Page -- http://php.net/manual/en/mysqli.query.php Edit -- https://master.php.net/note/edit/112353 Del: integrated -- https://master.php.net/note/delete/112353/integrated Del: useless -- https://master.php.net/note/delete/112353/useless Del: bad code -- https://master.php.net/note/delete/112353/bad+code Del: spam -- https://master.php.net/note/delete/112353/spam Del: non-english -- https://master.php.net/note/delete/112353/non-english Del: in docs -- https://master.php.net/note/delete/112353/in+docs Del: other reasons-- https://master.php.net/note/delete/112353 Reject -- https://master.php.net/note/reject/112353 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195082) next »