hukadeeze Posted May 15, 2007 Share Posted May 15, 2007 Can you use a queries results only once? In this script I'm looping through a query and saving some values in an array. A little further through the script I need to use the same query for output. When I loop through nothing is echo'd to the browser. When I output a row count it shows that the correct number of records, so they must still be there. Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/ Share on other sites More sharing options...
Barand Posted May 15, 2007 Share Posted May 15, 2007 use mysql_data_seek($result,0); to start back at row 0 again. Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254009 Share on other sites More sharing options...
hukadeeze Posted May 15, 2007 Author Share Posted May 15, 2007 'Warning: mysql_data_seek(): supplied argument is not a valid MySQL result resource' I tried both: mysql_data_seek($query,0); and $query = mysql_data_seek($query,0); I'm running the code directly after I exit a loop using the query. Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254022 Share on other sites More sharing options...
Barand Posted May 15, 2007 Share Posted May 15, 2007 Is $query the value returned by mysql_query()? Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254024 Share on other sites More sharing options...
hukadeeze Posted May 15, 2007 Author Share Posted May 15, 2007 I'm not using that variable name, I was just using it as a representation of the resultset. Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254025 Share on other sites More sharing options...
hukadeeze Posted May 16, 2007 Author Share Posted May 16, 2007 bump! Quote Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254111 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.