Re: Where clause
| From: | Ustimenko Alexander | Date: | Tue, 24 Aug 2004 12:40:24 +0000 |
| Subject: | Re: Where clause | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194569@lists.php.net to get a copy of this message | ||
read mysql manual: you must replace ' to `
'''''''''''''''''''''''''''''''''''''''''''''
to
`````````````````````````````` in your $sql so
$sql = "SELECT id_from, id_to FROM ids WHERE id_from =
$current_id OR
id_to=$current_id";
or more intelligent without ``````````` in your $sql so
$sql = "SELECT id_from, id_to FROM ids WHERE id_from =$current_id OR
id_to=$current_id";
because for ANY SQL DATABASE IN THIS WORLD something without " ' ` is
integer (your ids is integers???? :) )
"Phpu" <phpu@go.ro> ???????/???????? ? ???????? ?????????:
news:000801c489cc$f0e88340$9b00a8c0@analconda...
Hi,
I have a table with 2 fields: id_from and id_to.
I want to interogate the database and to display the results if the id_to is
equal to some current id OR id_from id_from is equla to saame current id.
I use this but doesn't work
$sql = "SELECT id_from, id_to FROM ids WHERE id_from ='$current_id' OR
id_to='$current_id' ";
$result = mysql_query($sql);
How can i do?
Thanks