|
Posted by Hilarion on 11/14/05 17:27
> ...WHERE fruit IN ("apple", "pear");
>
> is what I was the syntax I was looking for. The way to built the
> "name1","name2" separated by comma on the fly was what I was trying to find
> out.
>
> I actually found a perfect solution using implode at php site:
> http://ca3.php.net/implode the solution by "adrian at foeder doe de" was
> just what I was looking for.
Do NOT use double-quotes to quote strings in SQL statements. It works in
some SQL engines but in most of them it's NOT the proper way. Use
single-quote instead, which is (or should be) valid in all SQL engines
because it comes from SQL standards. So like this:
....WHERE fruit IN ('apple', 'pear')
and NOT like this:
....WHERE fruit IN ("apple", "pear")
Also remember that this one:
....WHERE fruit IN ()
will NOT be accepted by most of SQL engines, so you'll have to
treat this case (when nothing was selected by user) differently.
Hilarion
[Back to original message]
|