I have a section of my page that refreshes every 10 seconds to check if the user has any mails or alerts.
I have 2 queries straight after one another.
$sql_result7 = mysql_query("SELECT date FROM alerts WHERE to_id='$id' AND date > '$lastcheck'", $db);
$alerts = mysql_num_rows($sql_result7);
$rs7 = mysql_fetch_array($sql_result7);
$last_alert = $rs7[date];
$sql_result7 = mysql_query("SELECT date FROM mobmail WHERE to_id='$id' AND read = '0'", $db);
$mails = mysql_num_rows($sql_result7);
$rs7 = mysql_fetch_array($sql_result7);
$last_mail_alert = $rs7[date];
Is it possible to save trips to the database by combining this into one query? Is there any need to?