<?php $theplayer = ruthbabe01; ?>
<?php
mysql_connect("server", "user", "password");
mysql_select_db("database");
$sql = mysql_query("SELECT playerID,games FROM HittingStreaks WHERE playerID = '$theplayer' ORDER BY games DESC ");
echo "<h3>Hitting Streaks</h3>";
while($row = mysql_fetch_array($sql)){
$playerID = $row['playerID'];
$games = $row['games'];
echo "$playerID ... $games<br />";
}
?>
A simple little SELECT query, but I DO NOT want to see the echo "<h3>Hitting Streaks</h3>";
or the other echo "$playerID ... $games<br />";
if there is not a record that matches the query. In other words, if that player ($theplayer
) does not have a record in the table, do nothing. Don't echo any HTML.
Any help would be greatly appreciated.