Hi..

this is code to display the datas from db to web page ..

im not getting the outputphp,mysql


<?php
$host="localhost";
$username="";
$db_name="dbname";


.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$query="SELECT * FROM database";
$result=mysql_query($query);

$num=mysql_num_rows($result);

mysql_close();

echo "<b><center>List Of Employees</center></b><br><br>";

$i=0;
while ($i < $num) {

$name=mysql_result($result,$i,"name");
$fathersname=mysql_result($result,$i,"fathersname");
$address=mysql_result($result,$i,"address");


echo "<b>$name
$fathersname</b><br>$address<hr><br>";

$i++;
}

?>

The table name is "database"? check if your query is right. Bye.

nope..my db is sample and tablename is users

$query = "SELECT * FROM `database`"; // use backticks, database may be a reserved word
$result = mysql_query($query) or die(mysql_error()); // if it still fails, show use the error
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.