I have started a php page that pulls information from MySQL, but I need to tweak it, I’ve tried many things from MySQL documentation and from forums over the last three days with no luck.
Second_Class is by default Select One in the database, I need that not to echo if it is the default. (don’t display it)
Race_Date The date format is always different because of users form input I would like it to be consistent and really just month and day. I've got it so far in that database to be YY-MM-DD but if user input it wrong from the form I get 0000-00-00.
I'm trying to keep all this simple so I can fallow along as I'm trying to learn.
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT First_Name, First_Class, Second_Class, Race_Date FROM Registration ORDER BY Race_Date DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
if ($num==0) {
echo "<b>NO Drivers Registered Yet</b><br>";
}else{
}
mysql_close();
echo "<i><b>Registered Drivers</b></i><br>";
$i=0;
while ($i < $num) {
$First_Name=mysql_result($result,$i,"First_Name");
$First_Class=mysql_result($result,$i,"First_Class");
$Second_Class=mysql_result($result,$i,"Second_Class");
$Race_Date=mysql_result($result,$i,"Race_Date");
echo "<b>$First_Name<br>$Race_Date</b><br>$First_Class<br>$Second_Class</b><hr>";
$i++;
}
?>