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
How to retrive values from dbase
Moderator: General Moderators
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Re: How to retrive values from dbase
Provided that you're talking about a mysql database: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
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);
?>