Re: PHP sucks!! - was: persistent db connections in PHP

Поиск
Список
Период
Сортировка
От Erick Papadakis
Тема Re: PHP sucks!! - was: persistent db connections in PHP
Дата
Msg-id e9e8f77d0706161439i796e17bfo2a113a646b6808d7@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PHP sucks!! - was: persistent db connections in PHP  (PFC <lists@peufeu.com>)
Список pgsql-general
On 6/17/07, PFC <lists@peufeu.com> wrote:
>  I either use pg_query_params() which automagically handles all quoting,
> or an ORM which does the same.
>  There is no reason to include strings in SQL statements except laziness.
>  MySQL does not have a mysql_query_params() for PHP, so you have to write
> one, it's pretty simple.


Take your pick:

- Quotemeta
- Addslashes
- Htmlentities($string, 'utf-8')
- Magic_quotes in the INI
- Anti-XSS code (several available online)


> Python's (and perl) strength in this respect is that they make it easier
> to use the safe solution, ie, query( "sql with ? or $1 or %s", arg, arg, arg )


$sql = '"select column from table where field = '%s';
$sql = sprintf($sql, $submittedvariable);
..


> PEAR::DB is horrendous.
>

And hugely unnecessary.

EP

В списке pgsql-general по дате отправления:

Предыдущее
От: "Erick Papadakis"
Дата:
Сообщение: Re: PHP sucks!! - was: persistent db connections in PHP
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: about cursors