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? Quote 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 Quote 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 ) Quote 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] Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.