immanuelx2 Posted June 16, 2007 Share Posted June 16, 2007 $count_query = mysql_query('SELECT COUNT(*) FROM table'); $getcount = mysql_fetch_row($count_query); $count = $getcount['0']; vs. $count_query = mysql_query('SELECT * FROM table'); $count = mysql_num_rows($count_query); and... $query = mysql_query('SELECT * FROM table'); if (!$query) die(mysql_error()); vs. $query = mysql_query('SELECT * FROM table') or die(mysql_error()); any differences between those scenarios? Quote Link to comment Share on other sites More sharing options...
bubblegum.anarchy Posted June 16, 2007 Share Posted June 16, 2007 $count_query = mysql_query('SELECT COUNT(*) FROM table'); $getcount = mysql_fetch_row($count_query); $count = $getcount['0']; vs. $count_query = mysql_query('SELECT * FROM table'); $count = mysql_num_rows($count_query); One record is loaded into memory vs all the records loaded into memory $query = mysql_query('SELECT * FROM table'); if (!$query) die(mysql_error()); vs. $query = mysql_query('SELECT * FROM table') or die(mysql_error()) not a great deal or difference - readability mostly. 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.