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
Text file to .Dat file Conversion in PHP
Hi All,
Could anybody provide code for Text file to .Dat file Conversion in PHP.
Tha
Ajax Error since Upgrading to 3.5
Ever since upgrading my site to .NET 3.5 (I needed LINQ), I've been getting this annoying error on o
PHP Error
On my .php page I have a drop down box that has several names in it. When a user clicks the name &am
How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.
I am working on a application wh
Creating a db with a query
Hello everyone.
I'm having troubles creating a db with a query.
I'm reading a book called PHP
please help
HTML Code:
Code: <span id="ctl00"><span>
grouping within a foreach?
hello all,
I currently have a list of products spit out from my db via a foreach loop. Right
Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.
I have a banner s
how to load php class from another domain?
how to load php class from another domain?
Send current URL in URL with a $_GET variable problem.
Hello community,
I have created a function that gets the current variable of a page, example: