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
Join Query Help
Hi all,
I am having problems with the below code, which we shall call 'my first join query'!
Renaming array keys
The issue: renaming array keys inside a foreach loop.
I'm trying to build a pie chart image w
How to use Substr
I want to check for the word CATEGORY: inside a string which can be CATEGORY: ITEM
and remove the
How can use this array as a key?
Say I have this array for example:
print_r($array);
Prints:
Code: [Select]Array
j1inmis Ouput layout changes
Hi,
Can anybody tell how can j1inmis output layout can be changed so that vendor names ge
What's best way to get a user's Word doc converted to simple html and images?
Hi all,
I was just wondering if anybody has any experience of this.
Basically, I'm buildin
Secure FTP
Hi experts,
There is no SFTP action in MII workbench.
This means it needs developing custo
first id from db not showing
I have a php script which displays the content of a mysql table as a html table with sorting, delete
1,000 select boxes with 100 options?!
I have 1 drop down select box with 1,000 options.
In some case, there will be 100+ of the
How to change Time Zone
HI
I want to change the time zone of the server to another country.How can do that?
Thanks