how cant i delete relevant files from host along with mysql delete function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ayesham
    replied
    this thread is closed

    Leave a comment:


  • ayesham
    replied
    thank you GumSlone worked 100%

    Leave a comment:


  • GumSlone
    replied
    PHP Code:
    require('db.php');
    $id=intval($_REQUEST['id']);
    $query "SELECT * from files where id=".$id;
    $result mysqli_query($con,$query) or die ( mysqli_error());
    /* associative array */
    $row mysqli_fetch_array($resultMYSQLI_ASSOC);
    unlink($row['path']);
    unlink($row['cover_photo']);
    $query "DELETE FROM files WHERE id=".$id;
    $result mysqli_query($con,$query) or die ( mysqli_error()); 

    Leave a comment:


  • ayesham
    replied
    PHP Code:
    require('db.php');
    $id=$_REQUEST['id'];
    $query "SELECT * from files where id=".intval($id);
    unlink($row['path']);
    unlink($row['cover_photo']);
    $query "DELETE FROM files WHERE id=".intval($id);
    $result mysqli_query($con,$query) or die ( mysqli_error()); 
    this code is also not worked

    Leave a comment:


  • ayesham
    replied
    PHP Code:
    require('db.php');
    $id=$_REQUEST['id'];
    $query "DELETE FROM files WHERE id=".intval($id);
    unlink($row['path']);
    unlink($row['cover_photo']);
    $result mysqli_query($con,$query) or die ( mysqli_error()); 
    Admin though this code delete the mysql record original files are not deleting?? pls help me??

    Leave a comment:


  • ayesham
    replied
    Id , title , artist, path, cover_photo, size, date this is my structure

    Leave a comment:


  • GumSlone
    replied
    hi, your code is insecure, use:
    HTML Code:
    $query = "DELETE FROM files WHERE id=".intval($id);
    can you share the structure of your MySQL table?

    to delete from host use the unlink, i.e.
    HTML Code:
    unlink($row['path']);
    make sure that you select from files where id, then unlink and then do the delete in the database

    Leave a comment:


  • how cant i delete relevant files from host along with mysql delete function

    hello All,

    PHP Code:


    require('db.php');
    $id=$_REQUEST['id'];
    $query "DELETE FROM files WHERE id=$id";
    $result mysqli_query($con,$query) or die ( mysqli_error());
    header("Location: index.php"); 
    here is my php code to delete a the mysql records where id =$id

    this one record includes two files (mp3 file & jpg file) $row['path'] & $row['cover'].
    I would be very thankful if anyone can help me to find way for delete these mp3 & jpg files also from the host along with the mysql record.

Working...
X