php or sql?
Posted on
16th Feb 2014 07:03 pm by
admin
Sorry not sure if this is a sql problem or php the following code is supposed to delete data from the sql. However when I click delete nothing happens.
Code: <center>
Did you know?Explore Trending and Topic pages for more stories like this.
<b><u>Delete A Profile</u></b><p>
<form method='POST' action='deleteprofile.php'>
<?php
session_start();
if ($_POST['del_name']) {
$del_name=$_POST['del_name'];
$query = mysql_query("SELECT * FROM rp_staff WHERE name = '$del_name'");
$image = mysql_result($query, 0, "image");
if($image != "") {
$file = "/home/party/public_html/en/images/$image";
if (file_exists($file)) { unlink($file); $imagegone = "The profile image $image has been removed"; }
}
$result = mysql_query("DELETE FROM rp_staff WHERE name = '$del_name'");
echo "<center><h1><b>The profile of $del_name has been successfully deleted.</h1><p>";
if($imagegone != "") { echo "<h1><b>$imagegone</h1><p>";}
session_unregister ('del_name');
}
?>
<?php
$result = mysql_query("SELECT name FROM rp_staff ORDER BY name ASC");
echo '<select name="del_name">';
while($row = mysql_fetch_assoc($result))
{
echo '<option value="' . $row['name'] . '">' . $row['name'] . '</option>';
}
echo '</select>';
?>
<p><input type="submit" name="submit" value="Delete">
</form>
</center>
No comments posted yet
Your Answer:
Login to answer
226
49
Other forums
Simple email form - Newbie
Hello all,
First time poster!
I've been asked to create a simple HTML form that submit
Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bo
CU&UC guide
Hi Gurus,
can anybody provide me the link for CU&UC upgrade guide
Thanks i
PHP Tab Control
Hi All,
I would like to have PHP tab control with/without Javascript.
But I want to r
Edit MySQL Row Using PHP and HTML Form
Hello,
Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.
Calender Not Opening
The following code is not loading the javascript calender in another window. It's not doing anything
how to insert value
I am having file bookissueadd.php..... in which i am having tag
<td height="21&q
a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complca
TimeZoneOffset
Hello,
Please i need your help. I have a system that users can use to punch in and out. This
Reduce redundancies in switch functions?
Hello all! I somewhat new to PHP, and was wondering if anyone could give some suggestions on a swit