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>

226 Like 49 Dislike
Previous php-forum Next php-forum
Other php-forum

Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.

So I have a bas

Where is my php.ini???
Hi

First off - apologies - i'm not a coder so this may sound very amateur.

I'm having

date function help
i need help with date function

Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

PHP submit form script causing blank page
Im trying to submit a form using this script, however nothing shows up on the page, does anyone know

Adding to the next element in a multidimensional array
Hi, I'm trying to add a value to $node->field_spaces['nid'] where x is the next available spo

[PHP HELP] Php order form.
Hello to everyone @ phpfreaks. Im new to this site and hope to learn lots of things here.

Fir

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
what is wrong with this

Code: [Select]<?php
if ($_SERVER['HTTP_REFERER'])
{

question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

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