I'm trying to query my database for a show that comes on within a certain period of time. Code is below. Could someone give my mega-query a look and see if any errors syntax wise jumps out at them? Would be much appreciated. :-)
$pasttime = date('g:i A', strtotime('-60 minutes'));
$futuretime = date('g:i A', strtotime('+60 minutes'));
$currday = date('l');
if (!($conn = mysql_connect($db_host, $db_login, $db_password)))
die("***Cannot connect3:" . mysql_error());
if (!(mysql_select_db($db_name, $conn)))
die("***Cannot connect4:" . mysql_error());
//This query is giving me a headache! Keeps giving me errors to check the manual for the //correct syntax to use near the line 'As time bla bla..
$query = "SELECT show_id, show_name, show_desc, id, day, concat(date_format(time, '%l'), ':', date_format(time, '%i %p') AS time FROM wutv, showings WHERE showings.id = wutv.show_id AND showings.day LIKE '%{$currday}%' AND showings.time BETWEEN '{$pasttime}' AND '{$futuretime}' ORDER BY time ASC LIMIT 2";
if (!($result = @ mysql_query($query, $conn)))
die("***Error running query:" . mysql_error());