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); ?> Quote Link to comment 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, Quote Link to comment Share on other sites More sharing options...
orbitter Posted March 8, 2008 Author Share Posted March 8, 2008 thanks for the help, works great Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.