Hi there..
Okay I just make update page and it works okay and my problems is how to delete the old image from directory if I just upload/update a new image into my site...here''s the code I'm using
$intro_txt = mysql_escape_string($_POST['intro_txt']);
$id = $_GET["id"];
/////////img upload portion//////////////////
$uploadDir = "img/";
$uploadfile = $uploadDir . $_FILES['filename']['name'];
if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile))
{
$imagename = $_FILES['filename']['name'];
}
/////////////////////////////////////////////
$dbhostname = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "somedtbase";
$db = mysql_connect($dbhostname, $dbusername, $dbpassword);
mysql_select_db($dbname, $db) or die("ERROR: Cannot connect to the database");
//////////////////////////////////////////////
//if imagename is none
if( $imagename == "" or $imagename == 'none'){
$query = "UPDATE introduction SET textintro='$intro_txt',timedate = NOW()
WHERE id = '$id'";
$result = mysql_query($query);
}else{
//it'll replace the oldimage with new image in dtbase but how to delete the old image in directory
$query = "UPDATE introduction SET textintro='$intro_txt',imgname ='$imagename',
timedate = NOW() WHERE id = '$id'";
$result = mysql_query($query);
}
Hope some shed on light on this will be appreciate...
Thank you