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
49
Other forums
gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d
array help
Does anyone know how to require 10 text fields for individual grades and output class average? (10 p
Working with Dates, help.
Sooo to make a long story short, here's what im trying to accomplish.
I need to create a drop
Recode Abap Dynpro into Web Dynpro
Hi All,
A client has asked us to look at rearchitecting a custom transaction that was developed
Text file to .Dat file Conversion in PHP
Hi All,
Could anybody provide code for Text file to .Dat file Conversion in PHP.
Tha
New Search Engine
Hey everyone,
I have a ZIP Code Radius search engine already functional. it displays all of t
DOMDocument
Hello All,
I need to take an XML document, modify some of the nodes in it and then perform a
Error in SQL Syntax HELP!!!
I have this page:
Code: <?php
session_start();
//connect to server and s
Significance of BPM
Hi Experts,
I am a novice in BPM , I just want to know how BPM as permenant department is
Help with Hyperlink
Hi,
What I am trying to do may be simple, I just can't get it to work. Ok...
I am usin