Received: from visi.net (arsenal.visi.net [206.246.194.60]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0TIYtl89149 for ; Tue, 29 Jan 2002 13:34:55 -0500 (EST) (envelope-from jself@nngov.com) Received: from [216.54.6.254] (HELO localhost.localdomain) by visi.net (CommuniGate Pro SMTP 3.5) with ESMTP id 13402695 for pgsql-php@postgresql.org; Tue, 29 Jan 2002 13:33:44 -0500 Subject: Trouble with SQL statement using variable From: Jeff Self To: pgsql-php@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/1.0.1 Date: 29 Jan 2002 13:34:51 -0500 Message-Id: <1012329292.14152.5.camel@personnel_test> Mime-Version: 1.0 X-Archive-Number: 200201/86 X-Sequence-Number: 889 I'm having trouble getting an SQL statement to use a variable. Here's the statement: $sql = "SELECT emp_fname FROM employee WHERE username = '$username'"; $result = pg_exec($conn,$sql); if (!$result) { exit; } I get the following warning from this: Warning: Supplied argument is not a valid PostgreSQL link resource in /var/www/personnel/include/functions.inc on line 25 Is there another way to use a variable in an SQL statement. This format works with MySQL. -- Jeff Self Information Technology Analyst Department of Personnel City of Newport News 2400 Washington Ave. Newport News, VA 23607 757-926-6930