<html>
<head>
<title>Members
List</title>
<link href='/personalwebsite.com/css/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<?php
//display
data
//steps
//1.Define the database constants
define("DB_SERVER",'localhost');
define("DB_USER",'root');
define("DB_PWD",'');
define("DB_NAME",'personal_db');
//2.Connect to the database
$db=connect_db();
//3.Write sql query/statment
$sql="SELECT * FROM
members";
//4.execute the query
$result=mysql_query($sql,$db);
//5.display the result
while($row=mysql_fetch_array($result)){?>
<div class="fL">
<div><?php echo $row['name']?></div>
<div><?php echo $row['birth_month']." ".
$row['birth_day']." ".
$row['birth_year']?></div>
<div><?php echo $row['address']?></div>
<div><?php echo $row['contactno']?></div>
<div><?php echo $row['email']?></div>
</div>
<?php }
function
connect_db(){
$con=mysql_connect(DB_SERVER,DB_USER,DB_PWD);
if(!$con){die("Error: ".mysql_error());}
$db_select=mysql_select_db(DB_NAME,$con);
if(!$db_select){die("Error: ".mysql_error());}
return
$con;
}
?>
</body>
</html>

No comments:
Post a Comment