How to fetch inserted record from database using php

How to fetch inserted record from  database using php:

home

<?php
session_start();
$con=mysql_connect(“localhost”,”root”,””) or die(“mysql is not connected”);
$database=mysql_select_db(“myproject”,$con) or die(“database is not connected”);
if($_SESSION[‘username’]==” && $_SESSION[‘userpassword’]==”)
{
$_SESSION[‘msg’]=”Please enter login details”;
header(“Location:index.php”);
}
?>
<html>
<head>
<title>Fetch Records</title>

</head>

<body bgcolor=”#FFFFCC”>

<div style=”background-color:#006699; height:150px; width:100%; float:left; border:1px #000000 solid;”><div style=”float:right; margin-top:20px; margin-right:10px; color:#FFFFFF;”> Welcome USER <a href=”logout.php”>Logout</a></div></div>
<div style=”float:left; width:100%”>
<div style=”float:left; background-color:#00CCFF; width:24%; border:1px #000000 solid;”></div>
<div style=”background-color:#CCCCCC; height:50px; float:right; width:75%; border:1px #000000 solid;”>
<div style=”float:left; height:50px; width:100%;”>
<div style=”float:left; margin-top:20px; margin-left:10px;”>Manage User</div>
<div style=”float:right; margin-top:20px; margin-right:10px;”><a href=”addform.php” style=”text-decoration:none;”><input type=”button” name=”button” value=”add new” /></a></div>
</div>
</div>
<form name=”frm” action=”” method=”post”>
<div style=”float:right; background-color:#006666; width:75%; border:1px #000000 solid;”>
<div style=”float:left; height:50px; width:100%; padding-top:10px;”>
<div style=”float:left; margin-left:100px;”>Artist Name:<input type=”text” name=”artistname” value=”” /></div>
<div style=”float:left; margin-left:100px;”><input type=”submit” name=”search” value=”search” /></div>
<div style=”float:right; margin-right:10px;”>View All</div>

</div>
<?php
$query=”select * from artists”;
$result=mysql_query($query);
?>
<table width=”100%” border=”1″ bgcolor=”#FFCCCC”>
<tr  bgcolor=”#0099CC”><th>S.No</th>
<td>Artist Name</td>
<td>Adress</td>
<td>email</td>
<td>Phone</td>
<td>Image</td>
<td>Description</td>
<td>Status</td>
<td>Feture</td>
<td>Action</td>
<td></td>

</tr>
<?php
$i=1;
while($data=mysql_fetch_array($result))
{
//$id=$data[‘id’];
//$status=$data[‘status’];
?>
<tr  bgcolor=”#0099CC”>
<td><?php echo $i++; ?></td>
<td><?php echo $data[‘artistname’]; ?></td>
<td><?php echo $data[‘address’]; ?></td>
<td><?php echo $data[’email’]; ?></td>
<td><?php echo $data[‘phone’]; ?></td>
<td><img src=”<?php echo “img/”.$data[‘image_name’]; ?>” width=”88″ height=”96″/></td>
<td><?php echo $data[‘description’]; ?></td>
<td><?php echo $data[‘status’] ?></td>
<td></td>
<td><a href=”edit.php?id=<?php echo $data[‘id’] ?>”>Edit</a></td>

<td><input type=”checkbox” name=”checkbox[]” value=”<?php echo $data[‘id’]; ?>” /></td>
</tr>

<?php
}
?>

</table>

</div>
</form>
</div>
<div style=”background-color:#006699; height:150px; width:100%; float:left; border:1px #000000 solid; border-bottom:10px solid #CC3300″></div>
</body>
</html>

Please follow and like us:
0

Add a Comment

Your email address will not be published. Required fields are marked *