hukadeeze Posted May 18, 2007 Share Posted May 18, 2007 I'm running into problems using a single query more than once during the same request. I execute the query, pass it to one function where it is looped through, then pass it to another function where it is looped through again. When I loop through it the second time nothing is output. I checked from inside the second function to see if all the records were there, and they were. The loop is even executing the correct amount of times. It's just not outputting anything. Any idea? Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/ Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 Some code would be nice. Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255984 Share on other sites More sharing options...
hukadeeze Posted May 18, 2007 Author Share Posted May 18, 2007 There is a lot of code. Each function is quite long. I read something about a pointer for the query results. When you loop all the way through a query, does the pointer reset, or stop at the end? Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255987 Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 When you loop all the way through a query, does the pointer reset, or stop at the end? You don't loop through a query, you loop through a result. And yes, once you've looped all the way through the result it is not reset. You can use mysql_data_seek to move the result pointer back to the start. Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255988 Share on other sites More sharing options...
hitman6003 Posted May 18, 2007 Share Posted May 18, 2007 try it and find out... http://www.php.net/mysql_data_seek Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255990 Share on other sites More sharing options...
hukadeeze Posted May 18, 2007 Author Share Posted May 18, 2007 does the record set begin at 0 or 1? Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255993 Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 Did you even look at the man page? From that page.... row_number starts at 0. Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255995 Share on other sites More sharing options...
hukadeeze Posted May 18, 2007 Author Share Posted May 18, 2007 Warning: mysql_data_seek(): supplied argument is not a valid MySQL result resource ?? Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-255999 Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 Post the relevant code. Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-256000 Share on other sites More sharing options...
hukadeeze Posted May 18, 2007 Author Share Posted May 18, 2007 My result was mysqli, not mysql, so the function didn't match the result. It works now. Man so much frustration over something so small. Gotta love it. Link to comment https://forums.phpfreaks.com/topic/51925-solved-query-problems/#findComment-256002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.