homepage Welcome to WebmasterWorld Guest from 54.166.66.204
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
MySQL query has rows but doesn't have data?
jcmoon




msg:4054580
 4:50 pm on Jan 5, 2010 (gmt 0)

This happens from time to time, and I can't figure out why. I'll set up a query, and mysql_query->rows will show that a certain number of rows of data were sent back ... but then I use mysql_query->fetchrow_array to loop through the rows, and nothing happens.

Strange. MySQL says a certain number of rows are returned, but then there's no data whatsoever.

I've looked at the query, I've troubleshoot'ed every which way, and yet this happens, repeatably (often it's when I want a single colum of all distinct values for a field).

Has any one else experienced this?

 

jcmoon




msg:4054582
 4:54 pm on Jan 5, 2010 (gmt 0)

By the way, I have found a somewhat-reliable way around this issue, when it happens.

My intial query is this ... SELECT DISTINCT field FROM table ORDER BY field

... and if I then change it to ... SELECT field, COUNT( * ) FROM table GROUP BY field ORDER BY field

... it works fine (I just have to ignore the 2nd column in the resulting data).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved