Received: from tomts19-srv.bellnexxia.net (tomts19.bellnexxia.net [209.226.175.73]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0TJBXl00620 for ; Tue, 29 Jan 2002 14:11:33 -0500 (EST) (envelope-from fbax@sympatico.ca) Received: from ACER ([65.94.212.51]) by tomts19-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP id <20020129191133.CZMO25266.tomts19-srv.bellnexxia.net@ACER>; Tue, 29 Jan 2002 14:11:33 -0500 Message-Id: <3.0.6.32.20020129140932.020a06c0@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Tue, 29 Jan 2002 14:09:32 -0500 To: Jeff Self From: Frank Bax Subject: Re: Trouble with SQL statement using variable Cc: pgsql-php@postgresql.org In-Reply-To: <1012329292.14152.5.camel@personnel_test> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200201/87 X-Sequence-Number: 890 I believe this is a problem with $conn, not your sql syntax. How is $conn defined? Is it passed as an argument to the function containing this code, or defined as a global? Are you using pg_pconnect or pg_connect()? At 01:34 PM 1/29/02 -0500, Jeff Self wrote: >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 > > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > >http://www.postgresql.org/users-lounge/docs/faq.html >