Posted by Kimmo Laine on 05/28/05 00:05
"jedihawk" <jedihawk@gmail.com> kirjoitti
viestissδ:1117217889.720396.47310@g47g2000cwa.googlegroups.com...
>I don't see anything wrong with that code. Because you're appending to
> the $query var, it's just one single SQL query.
>
> BTW, I think your code would be slightly more efficient if you used
> this syntax:
>
> if( $name != '' ) $query .= "and name = '$name'";
>
Forgetting spaces here...
Something more like
if( $name != '' )
$query .= " and name = '$name' "; // padding string with some spaces
So the final query won't be
"select * from table where 1 = 1 and name = '$name'and month = '$month'and
year = '$year'";
but rather
"select * from table where 1 = 1 and name = '$name' and month = '$month'
and year = '$year' ";
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
eternal.erectionN0@5P4Mgmail.com
Navigation:
[Reply to this message]
|