Page 1 of 1

simple mysql "or" question

Posted: Thu Jul 10, 2003 10:46 am
by fariquzeli
what would be the mysql query syntax that I would use if I wanted to grab a row of informationi from a table based on whether a value is equal to 7 or 8?

would it be

$sql = "SELECT * FROM customers WHERE id = '7' OR '8'";

I don't think that is right at all but I really don't know if this is possible or not.

Thanks!

Re: simple mysql "or" question

Posted: Thu Jul 10, 2003 11:38 am
by redhair
I would try and get 7 or 8 before the querry, and turn it in a variable.

Code: Select all

<?php
$sql = "SELECT * FROM customers WHERE id = $solution";
?>

Posted: Thu Jul 10, 2003 11:40 am
by fariquzeli
Alrighty, thanks!

Posted: Thu Jul 10, 2003 12:38 pm
by Johnm
You could also use:

Code: Select all

$sql = "SELECT * FROM customers WHERE id IN (7,8);
John M