jimfog Posted March 29, 2013 Share Posted March 29, 2013 (edited) I am trying to use the mutli_query method and the problem is that I am having difficulty in retrieving the results from the db. We are talking here about 2 queries, an update and a select, with the latter being the last performed. Αs I see it I will have ti use more_result and next_result to get the results from the db. But my main question is how am I going to pass the result from next_result to an array of my choice? So far I used something like this: if( $result3 ->num_rows>0) {$wwwaddress=$result3->fetch_object(); $updateaddrs['wwwaddress']=$wwwaddress->wwwaddress; How next_result can be used in accordance with the above? And here is the code I am trying to implement: if ($conn->multi_query($query)) { if ($conn->more_results()) { $updateaddrs['wwwaddress']=$conn->next_result(); } } The above prints 1...weird Edited March 29, 2013 by jimfog Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2013 Share Posted April 1, 2013 The above prints 1...weirdThat's not weird. Like the documentation for next_result says, it returns a boolean value. True prints as 1, so it is returning true just like the documentation says. It doesn't return the result, it moves the internal result pointer. Look at the examples on the documentation page for multi_query, it shows how to use store_result to get the current result and loop through it. Link to comment Share on other sites More sharing options...
jimfog Posted April 1, 2013 Author Share Posted April 1, 2013 That's not weird. Like the documentation for next_result says, it returns a boolean value. True prints as 1, so it is returning true just like the documentation says. It doesn't return the result, it moves the internal result pointer. Look at the examples on the documentation page for multi_query, it shows how to use store_result to get the current result and loop through it.first of all thanks for anwsering.2nd, you are right in what you say. 3rd. I did something else after all-I think it does not worth it using multi_query for only 2 queries-unless you have different opinion about it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now