Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

what is wrong with my code.. please help
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

Report this thread to moderator Post Follow-up to this message
Old Post
S Kumar
12-27-04 08:55 PM


re: what is wrong with my code.. please help
well here a few things. 1. Have you setup your php.ini file
to log errors to your apache error_log file or a unique
php_error.log file

2. Lines $sql = "select * from experiment;"
$sth = pg_exec($connect,$sql)

are both missing sem-colons


also once you establish that errors are going to your lof files the rest
should be a peice of cake


Good luck

Rob
 ========================================
==============
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

Report this thread to moderator Post Follow-up to this message
Old Post
Rob Cartier
12-27-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:39 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.