You are here: Re: Query Question « PHP Programming Language « IT news, forums, messages
Re: Query Question

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация