Jump to content

[SOLVED] deleting from sql and dir


corillo181

Recommended Posts

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
Share on other sites

sorry bout that guys...

but i try usng that code and it don't work.. this is how i did it..

[code]
<?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');
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.