You so easily answered Imitation's question, I hope you can help me with mine. I have a similar problem, but mine is in inserting and not selecting. I get an "Undifined Index:" error on two inputs - hireDate and birthDate. The code is below.
<?php
$host="localhost";
$user="root";
$pass="xxxxxxxxx";
$db="demo";
$con = mysqli_connect($host,$user,$pass,$db);
$firstName=$POST['firstName'];
$lastName=$POST['lastName'];
$address=$POST['address'];
$city=$POST['city'];
$state=$POST['state'];
$zip=$POST['zip'];
$hPhone=$POST['hPhone'];
$pEmail=$POST['pEmail'];
$ssn=$POST['ssn'];
$department=$POST['department'];
$reportsTo=$POST['reportsTo'];
$hireDate=date("Y-m-d",strToTime($POST['hireDate']));
$jobTitle=$POST['jobTitle'];
$birthDate=date("Y-m-d",strToTime($POST['birthDate']));
$comments=$_POST['comments'];
$query = "INSERT INTO contacts(firstName,lastName,address,city,state,zip,hPhone,pEmail,ssn,department,reportsTo,jobTitle,comments,hireDate,birthDate)
VALUES('$firstName','$lastName','$address','$city','$state','$zip','$hPhone','$pEmail','$ssn','$department','$reportsTo','$jobTitle','$comments','$hireDate','$birthDate')";
$result = mysqli_query($con,$query);
if(!$result)
{
echo "There was an input error. Please try again.";
exit;
}
else
{
echo "Insert Successful, 1 record added";
}
mysqli_close($con);
?>