Re: Trouble with SQL statement using variable

From: jeff fitzmyers <fitz22(at)earthlink(dot)net>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: Trouble with SQL statement using variable
Date: 2002-01-29 20:02:01
Message-ID: 0F1A0EF2-14F3-11D6-9D8D-00306569F51E@earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Have you tried:
echo "CONN: $conn<br>";
echo "SQL: $sql<br>";
to see what is being passed to postgres?
Jeff

On Tuesday, January 29, 2002, at 10:34 AM, 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
>

In response to

Browse pgsql-php by date

  From Date Subject
Next Message servis 2002-01-31 04:53:00 Arama.com da En Cok Aranan Kelimeler
Previous Message Jeff Self 2002-01-29 20:01:21 Re: Trouble with SQL statement using variable