Re: [PHP] Re: [PHP-DB] what is wrong with my code.. please help

2004-12-26 Thread Burhan Khalid
S Kumar wrote:
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 ');
 exit;
 }
 $sql = "select * from experiment;"
 $sth = pg_exec($connect,$sql)
You are missing ; after the above two lines.
Please use a php syntax aware editor to avoid these problems.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [PHP-DB] what is wrong with my code.. please help

2004-12-26 Thread S Kumar


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 ');
 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!? 
Send holiday email and support a worthy cause. Do good. 
http://celebrity.mail.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php