kemper Posted March 10, 2007 Share Posted March 10, 2007 I do not clearly understand the if statements. I have a query that returns rows with match conditions. My WHERE pulls from a field with abbreviated information. I want to change that abbrebated field ($division) from say g910 TO Girls 9/10, and so on. I thought I understood it as: if ($division == g910) print("Girls 9/10"); else if ($division == g11/12) print("Girls 11/12") } Maybe my problem is the location I place the statement. Anyways, I get: Parse error: syntax error, unexpected T_STRING in /home/kemper/public_html/******/scores.php on line 27 Assistance is greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/42065-solved-if-field-abbreviated-description-question/ Share on other sites More sharing options...
tauchai83 Posted March 10, 2007 Share Posted March 10, 2007 <?php if ($division == 'g910'){ print("Girls 9/10"); } else { if ($division == 'g11/12') print("Girls 11/12"); } ?> try this and hope this help Link to comment https://forums.phpfreaks.com/topic/42065-solved-if-field-abbreviated-description-question/#findComment-204013 Share on other sites More sharing options...
kemper Posted March 10, 2007 Author Share Posted March 10, 2007 Where do I place it? My script is: <?php $db_con = mysql_connect(***, ***, ***) or die("Connetion to database failed!"); mysql_select_db(***); $div = $_GET['division']; $sql = "SELECT division gameid, date, time, home, h_score, visitor, v_score, field, field_no FROM s2007schedules WHERE division='$division'"; $result = mysql_query($sql) or die(mysql_error()); $i = 0; echo "<font face='Arial' size='4' color='#000000'><b>Spring 2007 Schedules & Scores for $division:</b></font><p style='margin-top: 0'> <font face='Arial' size='3'>To report game results, <u> <font color='#0000ff'><a href='http://www.******.***/viewpage.php?page_id=32'> <font color='#0000cc'>click here<br></font></a></font></u></font><br><br>\n\n"; echo "<table width='100%' border='1' cellspacing='0' cellpadding='5' bordercolorlight='#000000' bordercolordark='#000000'><tr> <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#FF0000' bordercolordark='#000000' width='15%'> <font face='Arial' color='#FFFFFF'>Date</font></th> <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#FF0000' bordercolordark='#000000' width='10%'> <font face='Arial' color='#FFFFFF'>Game ID</font></th> <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#FF0000' bordercolordark='#000000' width='50%'> <font face='Arial' color='#FFFFFF'>Teams</font></th> <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#FF0000' bordercolordark='#000000' width='5%'> <font face='Arial' color='#FFFFFF'>Scores</font></th> <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#FF0000' bordercolordark='#000000' width='20%'> <font face='Arial' color='#FFFFFF'>Details</font></th> </tr>"; while ($row = mysql_fetch_array($result)) { echo "<tr> <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#FF0000' bordercolordark='#000000' width='15%'> <table border='0' width='100%' id='table1' cellspacing='0' cellpadding='0'> <tr> <td><font face='Arial' size='2'>" . $row['Date'] . "</font></td> </tr> </table> </td> <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#FF0000' bordercolordark='#000000' width='10%'> <table border='0' width='100%' id='table2' cellspacing='0' cellpadding='0'> <tr> <td><font face='Arial' size='2'>" . $row['gameid'] . "</font></td> </tr> <tr> <td> <p align='right'><font face='Arial' size='2' color='#FF0000'>@</font></td> </tr> </table> </td> <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#FF0000' bordercolordark='#000000' width='50%'> <table border='0' width='100%' id='table3' cellspacing='0' cellpadding='0'> <tr> <td><font face='Arial' size='2'>" . $row['visitor'] . "</font></td> </tr> <tr> <td><font face='Arial' size='2'>" . $row['home'] . "</font></td> </tr> </table> </td> <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#FF0000' bordercolordark='#000000' width='5%'> <table border='0' width='100%' id='table4' cellspacing='0' cellpadding='0'> <tr> <td><font face='Arial' size='2'>" . $row['h_score'] . "</font></td> </tr> <tr> <td><font face='Arial' size='2'>" . $row['v_score'] . "</font></td> </tr> </table> </td> <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#FF0000' bordercolordark='#000000' width='20%'> <table border='0' width='100%' id='table5' cellspacing='0' cellpadding='0'> <tr> <td><font face='Arial' size='2'>" . $row['time'] . "</font></td> </tr> <tr> <td><font face='Arial' size='2'>" . $row['field'] . " " . $row['field_no'] . "</font></td> </tr> </table> </td> </tr>"; } echo "</table>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/42065-solved-if-field-abbreviated-description-question/#findComment-204014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.