Jump to content

Please help, i can't work out which part of code to get rid of!


ondi

Recommended Posts

Here is a snippet of my code:

 

while($data = mysql_fetch_array($get_matches))
		{
			if($i == 0)
			{
				echo"
				<tr>
				<td align=\"left\" colspan=\"2\">
				<b>$data[date]</b>
				</td>
				</tr>
				";
			}

			if($data['date'] != "$temp" && $i > 0)
			{
				echo"
				<tr>
				<td align=\"left\" colspan=\"1\">
				<br>
				<b>$data[date]</b>
				</td>
				</tr>
				";
			}

			echo "
			<tr>
			<td align=\"left\" valign=\"top\" width=\"90%\">
			$data[hometeam] $data[goals_home] - $data[goals_away] $data[awayteam]
			</td>
			<td align=\"left\" valign=\"top\" width=\"10%\">";

			if(!is_null($data['goals_home']))
				echo"$data[goals_home]-$data[goals_away]";
			else
				echo' ';


			echo"
			</td>
			</tr>";

			$temp = "$data[date]";

			$i++;
		}
	}

	mysql_free_result($get_matches);

	?>

	</table>

	<?php
	}
	?>

</td>
</tr>
</table>
</td>
</tr>
</table>

<?php
//
//INCLUDES FOOTER.PHP
//
include('footer.php');
?>

 

I'm trying to get rid of the part below, or just make it so the information this part of the query prints, does not show.

 

I keep getting error messages when i try to delete this part :(

 

<td align=\"left\" valign=\"top\" width=\"10%\">";

			if(!is_null($data['goals_home']))
				echo"$data[goals_home]-$data[goals_away]";
			else
				echo' ';


			echo"
			</td>
			</tr>";

			$temp = "$data[date]";

			$i++;
		}
	}

	mysql_free_result($get_matches);

	?>

	</table>

The part that prints [home_score] - [away_score]

 

NOT this part: $data[hometeam] $data[goals_home] - $data[goals_away] $data[awayteam]

 

What happens when you remove

 

				if(!is_null($data['goals_home']))
				echo"$data[goals_home]-$data[goals_away]";
			else
				echo' ';

 

?

Ahh it works a treat! :)

 

thanks for your help! When i was doing it, i was removing far larger chunks of code!

 

No problem - you probably just took out some of the other formatting you needed - go by the logic itself rather than the structure as a whole and all should be well ;)

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.