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

Combining Two Queries
I have two scripts that each work fine by themselves. One is a search script with a variable that de

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

PHP login form help (Done Most of It)
Hi i am having a problem, when i try logging in it is always saying "Invalid Login" im not

Undefined offset
The following script checks to see if the user answer matches the correct answer.

Form Fiel

Warning: session_start() headers already sent error - Driving me Nuts!
I am trying my sister in laws site and I keep getting an error with my coding. I am more of a design

Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to

phph within href not showing php if change ? to &
Code: [Select]<a href="<?php echo $puser; ?>?m=<?php=(($m-1)&l

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....

Warning: session_start() [fu

filesize problem
i use ubuntu 9.10 and i have mountet a folder from an windows

/mount/FOLDER
/mount/FOLDER/

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