Re: false No rows returned error
От | Dan Langille |
---|---|
Тема | Re: false No rows returned error |
Дата | |
Msg-id | 20020323173453.D386E3F30@bast.unixathome.org обсуждение исходный текст |
Ответ на | false No rows returned error (Jim Martinez <jjm@bigbigorg.org>) |
Ответы |
Re: false No rows returned error
Re: false No rows returned error |
Список | 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
В списке pgsql-sql по дате отправления: