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. 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. 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. 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()? 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. 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! Link to comment https://forums.phpfreaks.com/topic/51575-using-query-results/#findComment-254111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.