Jump to content

deleting user accounts php


orbitter

Recommended Posts

:(hi there, i was wondering if anyone could help me. i am trying to create a php file in order to delete a user from a table, what i have at the moment is a file which deletes a user who is typed into the actual code. what i am trying to do is create a file which gives someone a text box and asks which user they want to delete from the database. can anyone help?

 

 

the code  have already is this:

 

<?php

$con = mysql_connect("localhost","someone","abcdef");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }mysql_select_db("my_db", $con);

 

mysql_query("DELETE FROM test WHERE LastName='john'");mysql_close($con);

?>

Link to comment
https://forums.phpfreaks.com/topic/95071-deleting-user-accounts-php/
Share on other sites

$name = mysql_escape_string($_POST['name']);
mysql_query("DELETE FROM test WHERE LastName='$name'");mysql_close($con);

 

the for would be:

 

<form action="delete.php" method="post">
<input type="text" name="name" id="name">
<input type="submit" value="Delete"></form>

 

hope this helps,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.