From: | "Dan Langille" <dan(at)langille(dot)org> |
---|---|
To: | Jim Martinez <jjm(at)bigbigorg(dot)org> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: false No rows returned error |
Date: | 2002-03-23 17:35:14 |
Message-ID: | 20020323173453.D386E3F30@bast.unixathome.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 23 Mar 2002 at 11:04, Jim Martinez wrote:
> <?
> $conn=pg_connect("user=scott");
>
> // make sure I'mconnecting to the correc db
> echo "<b>database name:". pg_dbname($conn)."</b></hr>\n";
>
> if (!$conn){
> exit(" connection failed: " . __FILE__ . __LINE__ . "error: " .
> pg_errormessage($conn) );
> }
>
> $sql = "select pin, last_section_completed, comment from demographics";
>
> $res = pg_exec($conn, $sql) || exit ("query failed: ".__FILE__ . __LINE__
> ."<br> sql is $sql" );
Change the above to this, just to be sure:
res = pg_exec($conn, $sql);
if (!$result) {
echo "query failed: ".__FILE__ . __LINE__ ."<br> sql is $sql" );
exit;
}
> if (!$res){ exit ("post query check failed");}
BTW: the above if isn't necessary given the above.
>
> //
> // script dies here (line 36), falling to the exit clause.
> // A warning is printed also :
> // Warning: Supplied argument is not a valid
> // PostgreSQL result resource
> // in /home/www/test/php_debug.php on line 36
Listen to this error.
> $rows = pg_numrows($res) || exit ("No rows returned ".__FILE__ ." line:".
> __LINE__ . "<br> sql is $sql" ); // line 36
--
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/ - practical examples
From | Date | Subject | |
---|---|---|---|
Next Message | Dan Langille | 2002-03-23 17:38:36 | Re: false No rows returned error |
Previous Message | Tom Lane | 2002-03-23 17:13:37 | Re: false No rows returned error |