You are here: Re: return multiple rows from sql statement « PHP Programming Language « IT news, forums, messages
Re: return multiple rows from sql statement

Posted by Jerry Stuckle on 08/29/07 18:24

Jan Thomä wrote:
> Good Man wrote:
>> i'll assume this code is here for brevity, and that you're really making
>> sure that your $check variable contains what you're expecting it to (a
>> number).
>>
>> I tend to craft my SQL 'where' statements AFTER checking for variables,
>> assembling them as a string, and appending them to a query.
>
> I always use the placeholder notation for doing SQL. Concatening SQL strings
> from input values is almost certainly a safe path to SQL injection. So what
> i'd do is:
>
> foreach( ... ) {
> $where .= "OR id = ?";
> }
>
> and then use a framework like AdoDB to have them replace the placeholders.
> Saves a lot of time and problems...
>
> Best regards,
> Jan
>
>

Not if you properly cleanse your input. Ensure numeric values are
really numeric, and string values are processed through
mysql_real_escape_string(), for instance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация