0

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++;
}

?>

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by pritaeas
0
$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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.