[SOLVED] deleting from sql and dir
Posted 11 May 2006 - 12:02 AM
Posted 11 May 2006 - 12:04 AM
Posted 11 May 2006 - 12:24 AM
I suppose something like this, is what you have in mind:
<?php $query_file = mysql_query("SELECT * FROM files WHERE id = '$fileid' && userid = '$user_id'"); $fileinfo = mysql_fetch_array($query_file); $name = $fileinfo[filename]; $path = 'users/temp'; $thefile = $path.$name; unlink($thefile); mysql_query("DELETE FROM files WHERE id = '$fileid' && userid = '$user_id'"); ?>
I'm at work so...not tested, and not sure what method you are using to identify which file you are trying to delete....and so on.
Posted 11 May 2006 - 03:18 AM
but i try usng that code and it don't work.. this is how i did it..
<?php include'../includes/db.php'; $dir='/userpic/'; $pic=$_GET['delpic']; $delpath=$dir.$pic; unlink($delpath); $co="DELETE FROM userpic WHERE name='$pic'"; $cod=mysql_query($co); $ed=mysql_fetch_array($cod); header('Location: index.php'); ?>
Posted 11 May 2006 - 05:03 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users