Jump to content

[SOLVED] if ($field == abbreviated description) question


kemper

Recommended Posts

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!

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";

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.