php3-list | 200003
Date: 03/10/00
- Next message: Peter Mount: "RE: [PHP3] PostgreSQL Object ID from INSERT"
- Previous message: Peter Mount: "RE: [PHP3] PostgreSQL Support on Win32?"
- Maybe in reply to: Michael Fork: "[PHP3] PHP/Postgres Parse Error"
- Next in thread: Michael Fork: "RE: [PHP3] PHP/Postgres Parse Error"
- Reply: Michael Fork: "RE: [PHP3] PHP/Postgres Parse Error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I don't think this is the problem, mainly as in all my PHP code, I don't
include the semicolon (the pg_exec function doesn't need it because
libpq doesn't. Same goes for JDBC).
The only thing I can see is that there is no space between tbldealer and
(, but that shouldn't affect it.
Are all the fields strings?
Peter
-- Peter Mount Enterprise Support Maidstone Borough Council Any views stated are my own, and not those of Maidstone Borough Council.-----Original Message----- From: Max Pyziur [mailto:pyz <email protected>] Sent: Friday, March 10, 2000 1:17 AM To: Michael Fork; php3 <email protected> Subject: Re: [PHP3] PHP/Postgres Parse Error
Michael Fork wrote: > > When executing the following block of code: > > $sql = "INSERT INTO tbldealer(deal_code,deal_name,deal_location,deal_address1, deal_address2,deal_city,deal_state,deal_zip,deal_phone) VALUES ('$deal_code', '$deal_name', '$deal_location', '$deal_address1', '$deal_address2', '$deal_city', '$deal_state', '$deal_zip', '$deal_phone')"; > pg_exec($conn, $sql); > > The resulting sql string: > > INSERT INTO tbldealer(deal_code,deal_name,deal_location,deal_address1, deal_address2,deal_city,deal_state,deal_zip,deal_phone) VALUES ('C', 'Car-o-Rama', 'Anytown', '111 North St', '', 'Anytown', 'US', '55555', '8885555555') > > I receive the following error message (where line 18 is the pg_exec() funtion): > > Warning: PostgresSQL query failed: ERROR: parser: parse error at or near " " in /usr/home/baumann/public_html/adddealer.phtml on line 18 > > If I run psql and copy and paste the sql statement it inserts fine, just > doesn't work from PHP. Can anyone help me?
I think that you are missing a semi-colon at the .........very end.
$sql = "INSERT INTO tbldealer(deal_code,deal_name,deal_location,deal_address1, " ; $sql .= "deal_address2,deal_city,deal_state,deal_zip,deal_phone) VALUES ('$deal_code', "; $sql .= "'$deal_name', '$deal_location','$deal_address1', '$deal_address2', " ; $sql .= "'$deal_city', '$deal_state', '$deal_zip', '$deal_phone') ;"; /^ this one --------------------------------------------------------
pg_exec($conn, $sql);
> Thanks > > Michael Fork - CCNA - MCP - A+ > Network Support - Toledo Internet Access - Toledo Ohio >
-- Max Pyziur BRAMA - Gateway Ukraine pyz <email protected> http://www.brama.com/
-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Peter Mount: "RE: [PHP3] PostgreSQL Object ID from INSERT"
- Previous message: Peter Mount: "RE: [PHP3] PostgreSQL Support on Win32?"
- Maybe in reply to: Michael Fork: "[PHP3] PHP/Postgres Parse Error"
- Next in thread: Michael Fork: "RE: [PHP3] PHP/Postgres Parse Error"
- Reply: Michael Fork: "RE: [PHP3] PHP/Postgres Parse Error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

