[solved] deleting records

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

is this right?

PHP Code: [ Select ]
<?PHP
 
include("http://www.69kilobytes.co.uk/header.php");
 
include("http://www.69kilobytes.co.uk/cp/connect.php");
 
$sql = "DELETE INTO members [WHERE username]";
 
echo "<form action=delete_member.php method=post><br><input type=text name=username size=100><br><input type=submit name=submit size=20><br></form>";
 
include("http://www.69kilobytes.co.uk/footer.php");
 
?>
  1. <?PHP
  2.  
  3. include("http://www.69kilobytes.co.uk/header.php");
  4.  
  5. include("http://www.69kilobytes.co.uk/cp/connect.php");
  6.  
  7. $sql = "DELETE INTO members [WHERE username]";
  8.  
  9. echo "<form action=delete_member.php method=post><br><input type=text name=username size=100><br><input type=submit name=submit size=20><br></form>";
  10.  
  11. include("http://www.69kilobytes.co.uk/footer.php");
  12.  
  13. ?>


when i click "submit query" which should really say submit, it refreshes but when i check if the record is gone it is still there
  • steve101
  • Beginner
  • Beginner
  • steve101
  • Posts: 35

Post 3+ Months Ago

erm i'd really have the process script somewhere above the form on the page (php wise) so the process code (what i'd use) could be:

PHP Code: [ Select ]
 
if($_POST["submit"]){
 
$sql=mysql_query("DELETE FROM members WHERE username='$_POST[username]'") or die(mysql_error());
 
die('Member Deleted');
 
}
 
 
  1.  
  2. if($_POST["submit"]){
  3.  
  4. $sql=mysql_query("DELETE FROM members WHERE username='$_POST[username]'") or die(mysql_error());
  5.  
  6. die('Member Deleted');
  7.  
  8. }
  9.  
  10.  


Then have your form as normal html below that pretty much like you have, except just the form.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

thanks for your reply.

it has helped alot.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 58 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.