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>


<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 Like 49 Dislike
Previous forums Next forums
Other forums

Strange HTML Tag?
I recently noticed some odd HTML appear in some of the websites I host. Not all of them are run on a

Changing files over
Just thought I'd start with the new forums looking really nice .

Ok basically I've made this

Form validation with functions
Hi there

I am trying to make a very simple form validation function. I currently have the fol

Limiting uploaded file type
Hi. First post here
I am working on a simple upload script, and I need it to limit the allowed f

ClientScript.RegisterClientScriptBlock Issue
This is what I haveview plaincopy to clipboardprint?Protected Sub posrback_Click(ByVal sender As Obj

jquery validation in codeIgniter
hai i need to add client side validation to my fiels which are selected in a forloop.the fields are

New Search Engine
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

php/xmlrpc class issue
I am working on xml-rpc in php to start with.

I have a class that only has variables defined

Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so

To add a field on the screen XK02.
Hi All,

How to add an additional field in the vendor change control screen XK02.
The

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash