Re: Re: Where clause
| From: | Curt Zirzow | Date: | Wed, 25 Aug 2004 05:57:14 +0000 |
| Subject: | Re: Re: Where clause | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194653@lists.php.net to get a copy of this message | ||
* Thus wrote Ustimenko Alexander:
> read mysql manual: you must replace ' to `
>
>
> '''''''''''''''''''''''''''''''''''''''''''''
> to
> `````````````````````````````` in your $sql so
um.. what is with all of these qutes?
>
> $sql = "SELECT id_from, id_to FROM ids WHERE id_from
> =
$current_id OR
> id_to=$current_id";
This is wrong. Seing that this is mysql, a sequence of characters
enclosed within `` will be thus considered as a database token and
not as a value. Which will result with something like:
"Unkown column name '1234'"
if $current_id == 1234
>
> 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???? :) )
I can name a couple that this isn't allowed, but besides that, not
putting quotes around a value doesn't make it an integer.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!