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
How would I protect......
I have a from, actually, a good amount of forms. How can I make it so you can't type the characters:
imap: how to save a copy of sent emails to sent elements
Hello my friends,
I am writing an online emailing application with inbox outbox/sent elements
bit of help needed
Im about to sort out my registration page for my website by customising a "registration" s
Need a fuction to count entries in a field
Hi
I need a fuction to count how many times a email address is entered in to a field.
I ma
extract data
Code: <div class="post hentry uncustomized-post-template">
using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&
Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro
PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn ho
Production of mango in processing industry
Hi,
We have one scenario ,company is in process industry,they are manufacturing MANGO pul
Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a