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? Quote Link to comment Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 Some code would be nice. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 ?? Quote Link to comment Share on other sites More sharing options...
trq Posted May 18, 2007 Share Posted May 18, 2007 Post the relevant code. Quote Link to comment 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. Quote Link to comment 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.