corillo181 Posted May 11, 2006 Share Posted May 11, 2006 now this is something i'm clueless about.. i got to delete records from mysql with the get method, but how i do to delete from a dir anything a user has uploaded to a temp folder for the user.. Link to comment https://forums.phpfreaks.com/topic/9516-solved-deleting-from-sql-and-dir/ Share on other sites More sharing options...
trq Posted May 11, 2006 Share Posted May 11, 2006 Is there anything that difines which user owns whch files? Does each user have there own directory? You need to be more specific. Link to comment https://forums.phpfreaks.com/topic/9516-solved-deleting-from-sql-and-dir/#findComment-35117 Share on other sites More sharing options...
Caesar Posted May 11, 2006 Share Posted May 11, 2006 You need to be more specific...and at least show some sample code to give us an idea of what you're doing. It's not polite to expect the code to be written for you. I suppose something like this, is what you have in mind:[code]<?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'");?>[/code]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. Link to comment https://forums.phpfreaks.com/topic/9516-solved-deleting-from-sql-and-dir/#findComment-35119 Share on other sites More sharing options...
corillo181 Posted May 11, 2006 Author Share Posted May 11, 2006 sorry bout that guys...but i try usng that code and it don't work.. this is how i did it..[code]<?phpinclude'../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');?>[/code] Link to comment https://forums.phpfreaks.com/topic/9516-solved-deleting-from-sql-and-dir/#findComment-35145 Share on other sites More sharing options...
corillo181 Posted May 11, 2006 Author Share Posted May 11, 2006 sorry the code i just showed does work.. [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] Link to comment https://forums.phpfreaks.com/topic/9516-solved-deleting-from-sql-and-dir/#findComment-35153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.