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? Link to comment https://forums.phpfreaks.com/topic/55801-whats-the-difference/ 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. Link to comment https://forums.phpfreaks.com/topic/55801-whats-the-difference/#findComment-275729 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.