Hello,
I am trying to use unlink() and I get the following error:
Warning: unlink() expects parameter 1 to be string, array given in /home/mikepar8/public_html/admin/WMR_Admin_Lounge_Update.php on line 250
This code works in other files, but not this one.
Here is the area that is giving me troubles. Everything prints out fine, but I get this error.
Any thoughts? I appreciate it. Thanks!
<?php
function process_form() {
$isbn = $_POST['isbn'];
$currentname = $_FILES['upfile']['name'];
$newname = $currentname.date("Ymdhis");
$uploaddir = "../uploads/";
$imagename = $uploaddir.$newname;
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploaddir.'/'.$newname)) {
global $db;
print("file upload was successful");
$sql_delete_image = "SELECT isbn, image FROM lounge WHERE isbn = $isbn";
$rows_delete_image = $db->getRow($sql_delete_image);
$delete_image_name = $rows_delete_image[image];
unlink($rows_delete_image);
$sql_update_1 = "UPDATE lounge SET image='$imagename' WHERE isbn = $isbn";
$db->query($sql_update_1);
} else {
print("file upload failed");
}
// Access the global variable $db inside this function
global $db;
$artist_name = addslashes($_POST['artist_name']);
$album_title = addslashes($_POST['album_title']);
$release_date = $_POST['release_date'];
$description = nl2br(addslashes($_POST['description']));
$track_list = nl2br(addslashes($_POST['track_list']));
$price = $_POST['price'];
$top = $_POST['top'];
$mid = $_POST['middle'];
$bot = $_POST['bottom'];
$sql_update = "UPDATE lounge SET artist_name = ?, album_title= ?, release_date='$release_date', add_date='$add_date', description = ?, track_list = ?, price='$price', also_avail_top='$top', also_avail_mid='$mid', also_avail_bot='$bot' WHERE isbn = $isbn";
$db->query($sql_update, array($artist_name, $album_title, $description, $track_list));
}
?>