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!
simple mysql "or" question
Moderator: General Moderators
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
- redhair
- Forum Contributor
- Posts: 300
- Joined: Fri May 30, 2003 4:36 pm
- Location: 53.23N-6.57E
- Contact:
Re: simple mysql "or" question
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";
?>-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
- Johnm
- Forum Contributor
- Posts: 344
- Joined: Mon May 13, 2002 12:05 pm
- Location: Michigan, USA
- Contact:
You could also use:
John M
Code: Select all
$sql = "SELECT * FROM customers WHERE id IN (7,8);