how cant i delete relevant files from host along with mysql delete function
Collapse
X
-
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($result, MYSQLI_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:
-
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());
Leave a comment:
-
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());
Leave a comment:
-
Id , title , artist, path, cover_photo, size, date this is my structure
Leave a comment:
-
hi, your code is insecure, use:
HTML Code:$query = "DELETE FROM files WHERE id=".intval($id);
to delete from host use the unlink, i.e.
HTML Code:unlink($row['path']);
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");
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.
Tags: None
Leave a comment: