|
Posted by Joseph Melnick on 05/28/05 19:41
Hello Kimmo,
You are correct. missing spaces are another trap.
Adding white space between clauses is important.
Thank you for noticing.
Joseph Melnick
"Kimmo Laine" <eternal.erectionN0.5P@Mgmail.com> wrote in message
news:d78204$624$1@phys-news1.kolumbus.fi...
> "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]
|