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

How to make a mail Form secure?
I want to create an email Form on my web site. How can I make the Form secure so the submitted info

PHP and MySQL on intranet?
Is it possible to use both these on an intranet network?

Inserting Data into a MS Access DB using PHP.
As part of my uni course I am doing a placement at a company whom want me to create a client zone fo

DB2 for z/OS, LUW, iSeries
Hello, In this forum a lot of threads related to other members of the DB2 family than DB2 for z/OS

Get value from Select menu
Hi!

Have tried to find the solution on the web. Don't know if there is an easy one. A descrip

Trigger tag in aspx is not coming
hi all ,iam new to ajax, iam using file upload inside the update pannel but right now i want to use

Getting the full city list from maxminds geoip database
I am suprised I can't find any references to this.

I have maxminds geoip lite installed and i

Call Screen statement Error
Dear Experts,

is there any setting that needs to be done before creating any dialog progr

Posting to another Site?
I have software that people install.
When they install it, is there a way to make it post their d

with clause
hi all, i have a big query that usually access the same table more than once. for example, i have s

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