I am inserting data into my database as below;
$query = "INSERT INTO product VALUES ('','$prodName','$prodDesc','$supplier','$costPound', '$costPence')"; mysql_query($query);
All values are passed from a form and its all working fine.
I then want to query the databse and output products searched for by the user. e.g.
$query = "SELECT * FROM product WHERE productID = '$ID' OR prodName = '$prodName' OR prodDesc = '$prodDesc' OR supplier = '$supplier' OR costPound = '$costPound' OR costPence = '$costPence'"; $result = mysql_query($query); $num = mysql_numrows($result);
The problem is when the user specifies he/she wants the output contain the row he/she wants but also all other rows that contain the value 0. for example if a product cost £10.00 this is output because in the costPence column the value exists as 0.
How can i avoid this? Is there a method or some logic that i need??
Thanks in advance as always ppl!