what is wrong with my code.. please help
| From: | S Kumar | Date: | Sun, 26 Dec 2004 06:39:22 +0000 |
| Subject: | what is wrong with my code.. please help | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37854@lists.php.net to get a copy of this message | ||
Dear group,
I am trying to query my db and print the results.
when i execute my script, i am not getting any result
except a blank page. can any one please help me what
is going wrong with my script.
Script:
$conn = pg_connect("user = $user dbname = $dbname host
= $host password = $pass");
if (!$conn)
{
echo('could not establish connection with
database <br>');
exit;
}
$sql = "select * from experiment;"
$sth = pg_exec($connect,$sql)
if (! $sth){
die("Can't execute query".pg_errormessage());
}
for($i = 0,$j = pg_numrows($sth);$i < $j;$i++){
$ar = pg_fetch_row($sth,$i);
foreach($ar as $col){
print "$col ";
}
print "\n";
}
?>
thank you in advance
kumar
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com