Trouble with SQL statement using variable

From: Jeff Self <jself(at)nngov(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Trouble with SQL statement using variable
Date: 2002-01-29 18:34:51
Message-ID: 1012329292.14152.5.camel@personnel_test
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Frank Bax 2002-01-29 19:09:32 Re: Trouble with SQL statement using variable
Previous Message Mitch Vincent 2002-01-28 23:20:11 Re: pg_pconnect - ??