Bug #726: PHP/PG ERROR: parser: parse error at or near ","

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #726: PHP/PG ERROR: parser: parse error at or near ","
Дата
Msg-id 20020731132738.9A8EA47514F@postgresql.org
обсуждение исходный текст
Ответы Re: Bug #726: PHP/PG ERROR: parser: parse error at or near  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-bugs
Paul Redd-LaFlamme (predd-laflamme@strata-g.com) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
PHP/PG ERROR: parser: parse error at or near ","

Long Description
The SQL statement 
INSERT INTO users (user_name, comp_id, password) VALUES ('Yuk',8,'Yuk');

works fine when typed directly into the postgres shell, but yields the error

ERROR: parser: parse error at or near "," 

when, and only when the '8' is inserted into the string in PHP by any means.

In other words, the SQL statement provided works fine when hardcoded, but fails every single time (making my
applicationuseless) when the integer insert value is inserted into the PHP statement by any means.
 

I am using PostgreSQL 7.2.1 and PHP 4.2.1 on Redhat Linux. I couldn't find any instructions to find TODO so I can find
outif anyone else has had a similar problem. Please advise me how to do so. 

Sample Code
THE FOLLOWING WORK:
INSERT INTO users (user_name, comp_id, password) VALUES ('Yuk',8,'Yuk'); [typed directly into terminal]

$strSQL = "INSERT INTO users (user_name, comp_id, password) VALUES ('Yuk',8,'Yuk');";
$strResult = pg_query($dbConn, $strSQL);

$strSQL = "INSERT INTO users (user_name, comp_id, password) VALUES ($userName,8,$password);";
$strResult = pg_query($dbConn, $strSQL);


THE FOLLOWING FAIL:
$strSQL = "INSERT INTO users (user_name, comp_id, password) VALUES ($usernanme,$someinteger,$password);";
$strResult = pg_query($dbConn, $strSQL);

$strSQL = sprintf("INSERT INTO users (user_name, comp_id, password) VALUES (%s,%s,%s);", $usernanme, $someinteger,
$password);
$strResult = pg_query($dbConn, $strSQL);

No file was uploaded with this report

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

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #725: ODBC driver problem with internal type PG_TYPE_TIMESTAMP_NO_TMZONE
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Bug #726: PHP/PG ERROR: parser: parse error at or near