Select data from database


the use code selected data from database . the file name is select.php
<html>
<head>
<meta>
<title>select</title>
</head>

<body>
<?php
include(“db.php”);
$id=$_REQUEST[‘id’];
echo $id;
$query=”select * from record where id=$id”;
$row=mysql_query($query);
while($run=mysql_fetch_array($row))
{
?>
<h1 align=”center”>Employee Record</h1>
<form method=”post”>
<table border=”1″ align=”center” bgcolor=”#006699″>
<tr>
<td>firstname</td>
<td> <?php echo $run[‘firstname’];?> </td>
</tr>
<tr>
<td>lastname</td>
<td> <?php echo $run[‘lastname’];?> </td>
</tr>
<tr>
<td>fathername</td>
<td> <?php echo $run[‘fathername’];?> </td>
</tr>
<tr>
<td>dob</td>
<td> <select name=”dob”/>
<option>day</option>
<?php
for($day=1;$day<=31;$day++)
{
echo “<option>” .$day. “</option>”;
}
?>
</select>
<select>
<option>month</option>
<?php
$month=array(‘jan’,’feb’,’mar’,’april’,’may’,’june’,’july’,’aug’,’sep’,’oct’,’nov’,’dec’);
foreach($month as $a)
{
echo “<option>” .$a.”</option>”;
}
?>
</select>
<select>
<option>year</option>
<?php
for($year=1985;$year<=2013;$year++)
{
echo “<option>” .$year . “</option>”;
}
?>
</select>
</td>
</tr>
<tr>
<td>contactno</td>
<td> <?php echo $run[‘contactno’];?> </td>
</tr>
<tr>
<td>address</td>
<td> <?php echo $run[‘address’];?> </td>
</tr>
<tr>
<td>agreementsign</td>
<td> <?php echo $run[‘agreementsign’];?> </td>
</tr>
<tr>
<td>email</td>
<td> <?php echo $run[’email’];?> </td>
</tr>
<tr>
<td>password</td>
<td> <?php echo $run[‘password’];?> </td>
</tr>
<tr>
<td>gender</td>
<td> <input type=”radio” name=”gender” value=”m” />male
<input type=”radio” name=”gender” value=”f” />female</td>
</tr>
<tr>
<td colspan=”2″ align=”center”> <input type=”submit” name=”submit” value=”submit” /></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>

Leave a comment