Desmond Coughlan wrote:
> <?php
> pg_connect ("dbname=cdi user=cdi password=toto") or die
> ("Couldn't Connect: ".pg_last_error());
> $query="SELECT * FROM stock";
> $query=pg_query($query);
Firstly, rewrite this as
$sql = "SELECT * FROM stock";
$res = pg_query($sql);
echo "pg_query($sql) = $res<br>";
echo "num rows = ".pg_num_rows($res)."<br>";
> // start the output
> while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
> echo "Title: ".$row['isbn_no']."<br />";
> echo "blah ".$row['code_livre']."<br />";
> }
> ?>
Now you'll know what the return-code of pg_query was as well as how manu
rows it returned. Does that help at all?
--
Richard Huxton
Archonet Ltd