The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 Update
Author: Gerard Samuel 
Date:   20-06-02 07:44

Some php code with respect to postgresql has been changed lately, so here is an updated example....
I currently using php 4.2.1

<?php

$conn = pg_connect("dbname=test user=myuser");

if ($conn)
{
$result = pg_exec ($conn, 'select * from test');
if ($result)
{
echo pg_numrows($result) . ' rows to fetch' . "\n";
echo '<table border="1" width="50%">' . "\n";

while ($myrow = pg_fetch_array ($result))
{
echo '<tr><td>' . $myrow['id'] . '</td><td>' . $myrow['name'] . '</td></tr>' . "\n";
}

echo '</table>' . "\n";
}
else
{
echo 'read from test failed';
}
}
else
{
echo 'no connection';
}

?>

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 Update   new
Gerard Samuel 20-06-02 07:44 
 Re: Update   new
Gerard Samuel 20-06-02 07:56 
 Re: Update   new
Dan Langille 20-06-02 14:38 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org