orbitter Posted March 8, 2008 Share Posted March 8, 2008 :(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 More sharing options...
uniflare Posted March 8, 2008 Share Posted March 8, 2008 $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, Link to comment https://forums.phpfreaks.com/topic/95071-deleting-user-accounts-php/#findComment-486980 Share on other sites More sharing options...
orbitter Posted March 8, 2008 Author Share Posted March 8, 2008 thanks for the help, works great Link to comment https://forums.phpfreaks.com/topic/95071-deleting-user-accounts-php/#findComment-487001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.