Re: PEAR::DB 1.6.4 problem with quoteSmart()
| From: | Torsten Roehr | Date: | Wed, 30 Jun 2004 18:13:39 +0000 |
| Subject: | Re: PEAR::DB 1.6.4 problem with quoteSmart() | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13422@lists.php.net to get a copy of this message | ||
>Hi Torsten Roehr, you wrote:
>
>> Hi,
>>
>> I've got a problem with quoteSmart() in PEAR::DB 1.6.4:
>>
>> I've got the following query: $query = "SELECT * FROM table WHERE
>> userName = '" . $db->quoteSmart($user) . "' AND password =
>> '" .
>> md5($password) . "'";
>
>> Of course it's easy to solve by not putting quotes around my value in
>> the query manually. But isn't it the responsibility of the
>> application/developer to decide if a value should be put between
>> quotes or not in the query!?! This has nothing to do with escaping
>> quotes within the value.
>>
>> Any ideas on this?
>
>Well, note the *smart* in the method name.
>quoteSmart() should take care of that, so you
>don't have to care about the quotes.
Thanks, Michael. Now I see what the 'smart' stands for... Have to adapt all
my SQL statements now.
Regards, Torsten