Re: PostgreSQL and select nextval

From: Date: Thu, 16 Aug 2007 12:40:23 +0000
Subject: Re: PostgreSQL and select nextval
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-260909@lists.php.net to get a copy of this message
Alain Roger wrote:
Hi, I'm getting an error message when i run the following SQL request : $sql = "INSERT INTO tmp_importedxls (rec_id, publisher) VALUES (SELECT nextval('tmp_importedxls_rec_id_seq'),'$pb')"; Error in SQL query: ERROR: syntax error at or near "SELECT" LINE 2: VALUES (SELECT nextval('tmp_importedxls_rec_id_seq'),' ^
You don't use SELECT, just put nextval(...) INSERT INTO tmp_importedxls (rec_id, publisher) VALUES (nextval('tmp_importedxls_rec_id_seq'),'$pb') Luck! -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 --------------------------------------------------------- Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar'; Universidad Nacional | DBA, Programador, del Litoral | Administrador ---------------------------------------------------------

« previous php.general (#260909) next »