Pezzoni Posted November 11, 2006 Share Posted November 11, 2006 Like the title says.For example, if I have n rows in a database, then run 'SELECT *' on it, then n-1 rows are always returned (the newest one is left off). This is happening at the most basic level of the result returned by mysql_query, so I really have no idea what is wrong. Does anyone have any suggestions?Thanks,Dan Quote Link to comment Share on other sites More sharing options...
toplay Posted November 12, 2006 Share Posted November 12, 2006 For these types of problems, it's always recommended that you post the exact code so members of this forum can help you better.However, it's been my experience that it's usually attributed to a coding logic mistake (as opposed to a SQL query problem).Common mistakes:Running a fetch command before doing fetches in a while loop, causing the first row not to get processed.Exiting a while loop that's fetching data prematurely (like using break).Relying on a counter (for number of rows in the result) and the counter is manipulated erroneously.Using LIMIT and the values aren't correct. Quote Link to comment Share on other sites More sharing options...
Pezzoni Posted November 12, 2006 Author Share Posted November 12, 2006 Not quite a logic error, but a bit of copy&paste related stupidity on my behalf. I had a mysql_fetch_array() on it's own, in addition to the one I used to build an index of the results. Which shouldn't have been there.Thanks for the help, and sorry for the dumb-ass mistake... There goes another 3 hours of my life! :D 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.