devknob Posted August 23, 2010 Share Posted August 23, 2010 im not new enough for this to take so long to figure out, but for some reason $rs = mysql_query("SELECT * FROM cl"); returns the last record instead of all the records in the table. anyone know why it wouldnt take everything? Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/ Share on other sites More sharing options...
MadTechie Posted August 23, 2010 Share Posted August 23, 2010 Yep but case the error is on another line Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/#findComment-1102649 Share on other sites More sharing options...
devknob Posted August 23, 2010 Author Share Posted August 23, 2010 <? $conn = mysql_connect('localhost', 'un', 'pw') or die ('Error connecting to mysql'); mysql_select_db('db'); $rs = mysql_query("SELECT post FROM cl"); $existing = mysql_fetch_assoc($rs); print count($existing); print_r($existing); ?> thats the whole file, the connection info is correct. There are hundreds of 100% complete records in that db, the post column is type Int and is filled with numbers. The above returns: 1 Array ( => 1913763485 ) Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/#findComment-1102653 Share on other sites More sharing options...
devknob Posted August 23, 2010 Author Share Posted August 23, 2010 heres a pic of the cl table for the next post thats going to say "theres nothing in your db" [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/#findComment-1102656 Share on other sites More sharing options...
kickstart Posted August 23, 2010 Share Posted August 23, 2010 Hi mysql_fetch_assoc just fetches a single row. You need to repeat that for each row, and print_r() each row. All the best Keith Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/#findComment-1102658 Share on other sites More sharing options...
devknob Posted August 23, 2010 Author Share Posted August 23, 2010 pfft. now i just feel retarded. thanks lol Link to comment https://forums.phpfreaks.com/topic/211486-select-only-returns-1-row/#findComment-1102661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.