PHP - where clause equals 2 values grabbed from URL is not showing any
results?
I am trying to get the results for a specific race at a specific meet.
raceresult.php?meet=<i>August Meet</i>&race=<i>Allowance Fillies 2yo</i>
The meet and race are showing up from the first query and some of the
results show. For example:
THIS ONE WORKS
raceresult.php?meet=meet=2013 OJCR Australian Derby&race=Allowance - 9f on
turf 3yo
DOES NOT WORK
raceresult.php?meet=2009 Gulfstream Park Grand Opening Meet&race=Flying
Stakes - Grade I, 3 yr old+, 8F on dirt
Are there any characters causing an error in the second example? I can go
through and fix that issue pretty easily but I'm not really sure what is
keeping that URL from working while the other one works great.
My code is as follows.
<?php
$sql = "SELECT * FROM racing WHERE `meet` = '$meet' LIMIT 1";
$query = mysql_query($sql) or die( mysql_error() . "<br />" . $sql );
while($row = mysql_fetch_array($query)){
$date= $row['date'];
echo "<h2><strong>$meet</strong> ($date)</h2>";
echo "<b>$race</b><br>";
}
?>
<?php
$sql = "SELECT * FROM racing WHERE `meet`='$meet' and `race`='$race' ORDER
BY place";
$query = mysql_query($sql) or die( mysql_error() . "<br />" . $sql );
while($row = mysql_fetch_array($query)){
$place= $row['place'];
$horse= $row['horse'];
$farm= $row['farm'];
echo"$place. $horse owned by $farm";
}
?>
No comments:
Post a Comment