I think I've changed every single comma/quote in this page. However, it seems to be a moving target. Can anyone PLEASE advise as to where my error is coming from? I believe the error is in the sql query format though it works perfectly fine in Navicat. Your answer could prevent someone from losing their mind! Thanks in advance! Upcoming Schedule <form action="" method="post"> <select name="team_id"> <option value="33" selected="selected">default pick</option> <option value="999">team 999</option> <option value="11">team 11</option> <option value="22">team 22</option> </select> <br><br> <input type="Submit"> </form> // FROM HERE <?php $team_id = JRequest::getVar('team_id'); $username=xxx_x; $password="xxx1"; $database="xxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT uba_teams.team_coach, uba_teams.team_name, uba_schedule.sch_date, uba_schedule.game_location, uba_schedule.game_time, uba_schedule.opp_name FROM uba_schedule INNER JOIN uba_teams ON uba_schedule.team_id = uba_teams.team_id WHERE (uba_schedule.sch_uba_score IS NULL) AND (CASE $team_id WHEN 999 THEN uba_teams.team_id ELSE uba_teams.team_id = $team_id END) ORDER BY uba_schedule.sch_date ASC $result=mysql_query($query); $num=mysql_numrows($result); ?> <table border="2" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">player_id</font></th> <th><font face="Arial, Helvetica, sans-serif">first</font></th> <th><font face="Arial, Helvetica, sans-serif">last</font></th> <th><font face="Arial, Helvetica, sans-serif">age group</font></th> <th><font face="Arial, Helvetica, sans-serif">game id</font></th> <th><font face="Arial, Helvetica, sans-serif">coach name</font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"uba_teams.team_coach"); $f2=mysql_result($result,$i,"uba_teams.team_coach"); $f3=mysql_result($result,$i,"uba_teams.team_coach"); $f4=mysql_result($result,$i,"uba_teams.team_coach"); $f5=mysql_result($result,$i,"uba_teams.team_coach"); $f6=mysql_result($result,$i,"uba_teams.team_coach"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> </tr> <?php $i++; } ?> Code (markup):
Upcoming Schedule <form action="" method="post"> <select name="team_id"> <option value="33" selected="selected">default pick</option> <option value="999">team 999</option> <option value="11">team 11</option> <option value="22">team 22</option> </select> <br><br> <input type="Submit"> </form> // FROM HERE <?php $team_id = JRequest::getVar('team_id'); $username=xxx_x; $password="xxx1"; $database="xxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT uba_teams.team_coach, uba_teams.team_name, uba_schedule.sch_date, uba_schedule.game_location, uba_schedule.game_time, uba_schedule.opp_name FROM uba_schedule INNER JOIN uba_teams ON uba_schedule.team_id = uba_teams.team_id WHERE (uba_schedule.sch_uba_score IS NULL) AND (CASE $team_id WHEN 999 THEN uba_teams.team_id ELSE uba_teams.team_id = $team_id END) ORDER BY uba_schedule.sch_date ASC"; $result=mysql_query($query); $num=mysql_num_rows($result); ?> <table border="2" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">player_id</font></th> <th><font face="Arial, Helvetica, sans-serif">first</font></th> <th><font face="Arial, Helvetica, sans-serif">last</font></th> <th><font face="Arial, Helvetica, sans-serif">age group</font></th> <th><font face="Arial, Helvetica, sans-serif">game id</font></th> <th><font face="Arial, Helvetica, sans-serif">coach name</font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"uba_teams.team_coach"); $f2=mysql_result($result,$i,"uba_teams.team_coach"); $f3=mysql_result($result,$i,"uba_teams.team_coach"); $f4=mysql_result($result,$i,"uba_teams.team_coach"); $f5=mysql_result($result,$i,"uba_teams.team_coach"); $f6=mysql_result($result,$i,"uba_teams.team_coach"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> </tr> <?php $i++; } ?> PHP: You forgot to close ( closing quote and semicolon missing ) $query.
I think I've been looking at this too long. WHERE specifically are these closing quotes supposed to be in $query? Could you show me?
By the way you used Joomla framwork(JRequest) why you don't use database object ?$db =& JFactory::getDBO() http://docs.joomla.org/JDatabase