Page 1 of 1
How to retrive values from dbase
Posted: Sun Aug 20, 2006 4:59 am
by umapathy
Dear all
I have a table. in the table totaly three fields, like name , age , address
i want to display these three fields values in a PHP page. or inside a html table
i need code. i know db connection coding. and i need retrive coding.
Regards
Umapathy
Posted: Sun Aug 20, 2006 5:05 am
by anjanesh
Are you talking about
dbase or
database ?
If its the latter, which database are you using - MySQL, PostgreSQL, MS SQL, Sybase, DB2 etc ?
Re: How to retrive values from dbase
Posted: Sun Aug 20, 2006 5:20 am
by aerodromoi
umapathy wrote:Dear all
I have a table. in the table totaly three fields, like name , age , address
i want to display these three fields values in a PHP page. or inside a html table
i need code. i know db connection coding. and i need retrive coding.
Regards
Umapathy
Provided that you're talking about a mysql database:
Code: Select all
<?php
$host = "";
$user = "";
$pass = "";
$database = "";
$table = "";
$db = @mysql_connect($host, $user, $pass) or die(mysql_error());
@mysql_select_db($database, $db) or die(mysql_error());
$query = "SELECT namec,agec,addressc FROM ".$table." ORDER BY namec DESC";
$result = @mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
print($row['namec'].", ");
print($row['agec'].", ");
print($row['addressc']."<br />\n");
}
mysql_close($db);
?>