MjM8082 Posted August 2, 2011 Share Posted August 2, 2011 I have a Database, and I am able to add users. I am trying to figure out how to delete users from my database when the delete button is clicked on. Also I want users to be able to update their information when they click on the update button. This is my code... need help as soon as possible. thanks... This is my page where the update/delete button's are located on... <html xmlns="http://www.w3.org/1999/xhtml"> <!-- the head section --> <head> <title>Update User</title> </head> <!-- the body section --> <body> <h1>Update User</h1> <?php //echo $_GET['id']; if (isset($_POST['btn_update'])) { echo "My update stuff goes here"; } else if (isset($_POST['btn_delete'])) { echo "My delete stuff goes here"; } ?> <form name="my_form" method="post" action="update_user.php"> User Name: <input type="text" name="user_name"><br /> First Name: <input type="text" name="first_name"><br /> Last Name: <input type="text" name="last_name"><br /> Password: <input type="text" name="pwd"><br /> Admin: <input type="text" name="is_admin"> <input type="submit" name="btn_update" value="Update User" /> <input type="submit" name="btn_delete" value="Delete User" /> </form> </body> </html> This is my database page... <?php $dsn = 'mysql:host=localhost;dbname=se266'; $username = 'se266_user'; $password = 'pwd'; try { $db = new PDO($dsn, $username, $password); } catch (PDOException $e) { $error_message = $e->getMessage(); include('database_error.php'); exit(); } ?> Quote Link to comment Share on other sites More sharing options...
gizmola Posted August 2, 2011 Share Posted August 2, 2011 Please read pdo.exec Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 2, 2011 Share Posted August 2, 2011 MjM8082 do u know how to delete a recoed. 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.