I have a PHP statment that $_GET's input from a html page and uses that input(customerID) to search through the database for appropriate results. I have that working fine. What i want to do is, if the user enters an invalid customerID, i want the system to give a message and terminate, else if the user input is correct, i want it to be business as usual.
$id = $_GET['customerID'];
$conn = mysql_connect("localhost", "user", "password");
mysql_select_db("databse", $conn)
or die ('Database not found ' . mysql_error() );
$sql = "SELECT .......
WHERE order.customerID = $id
ORDER BY order.orderDate ASC";
if($id != 'order.customerID'){
die('Invalid Customer ID entered');}
else
{
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());
}
Thats my php code. When i run that, if i enter a invalid ID, it will show me 'Invalid Customer ID entered' but when i enter a vaild customerID, it still shows me that error message. Obviously im making a mistake which im not seeing, any help would be appreciated.