i want to edit my database without image
when i click the edit link ,the image is not show in my browse input type
this is my code
db.php
Code:
<?php
$server="localhost";
$username="root";
$password="";
$dbname="zz";
$connection =mysql_connect($server,$username,$password);
$db = mysql_select_db($dbname,$connection);
?>
list.php
Code:
<?php
require('db.php');
?>
<table>
<tr><td>Id</td><td>Name</td><td>Photo</td><td>Prize</td><td>Edit</td></tr>
<?php
$sql = "SELECT * FROM edit";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $row[0]; ?></td>
<td><? echo $row[1]; ?></td>
<td><img src="images/<? echo $row[2]; ?>"></td>
<td><? echo $row[3]; ?></td>
<td><a href="edit.php?id=<?php echo $row[0]; ?>">Edit</a></td>
</tr>
<?php
}
?>
</table>
edit.php
Code:
<html>
<?php require('db.php'); ?>
<head><title>add</title></head>
<body>
<?php
if(isset($_GET['id'])){
$id=$_GET['id'];
$result=mysql_query("SELECT * FROM edit WHERE id='$id'");
$row=mysql_fetch_assoc($result);
?>
<form action="edit.php" method="post" enctype="multipart/form-data" >
Name: <input type="text" name="name" value="<?php echo $row['name']; ?>"/><br/>
Photo: <input type="file" name="photo" value="<?php echo $row['photo']; ?> " /><?php echo $row['photo'];?><br/>
Prize : <input type="text" name="prize" value="<?php echo $row['prize']; ?>"/><br/>
<input type="hidden" name="hid" value="<?php echo $row['id']; ?>"/>
<input type="submit" name="insert" value="Insert"/>
</form>
<?php
}
?>
<?php
if(isset($_POST['insert'])){
$hid=$_POST['hid'];
$name=$_POST['name'];
$photo=$_FILES['photo']['name'];
$prize = $_POST['prize'];
$query = "UPDATE edit SET name='$name',photo='$photo',prize='$prize' WHERE id='$hid'";
$result= mysql_query($query);
move_uploaded_file($_FILES["photo"]["tmp_name"],"images/" . $_FILES["photo"]["name"]);
}
?>
<body>
</html>
problem code
Code:
Photo: <input type="file" name="photo" value="<?php echo $row['photo']; ?> " /><?php echo $row['photo'];?><br/>
I want to show image name in input file value box ,when i edit this file is empty.
i don't want to edit my photo , i just edit my text
my problem is when i edit the text and not choose the image ,the image is empty .Anybody know how to solve this problem?
Thanks for your appreciate.