Thanks so much !!!
Thanks so much !!!
CREATE TABLE `user` ( `userid` INT(11) NOT NULL AUTO_INCREMENT, `firstname` VARCHAR(30) NOT NULL, `lastname` VARCHAR(30) NOT NULL, PRIMARY KEY (`userid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
<?php // Check connection { } ?>
<!DOCTYPE html> <html> <head> <title>Basic MySQLi Commands</title> </head> <body> <div> <form method="POST" action="add.php"> <label>Firstname:</label><input type="text" name="firstname"> <label>Lastname:</label><input type="text" name="lastname"> <input type="submit" name="add"> </form> </div> <br> <div> <table border="1"> <thead> <th>Firstname</th> <th>Lastname</th> <th></th> </thead> <tbody> <?php include('conn.php'); ?> <tr> <td><?php echo $row['firstname']; ?></td> <td><?php echo $row['lastname']; ?></td> <td> <a href="edit.php?id=<?php echo $row['userid']; ?>">Edit</a> <a href="delete.php?id=<?php echo $row['userid']; ?>">Delete</a> </td> </tr> <?php } ?> </tbody> </table> </div> </body> </html>
<?php include('conn.php'); $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; ?>
<?php include('conn.php'); $id=$_GET['id']; ?> <!DOCTYPE html> <html> <head> <title>Basic MySQLi Commands</title> </head> <body> <h2>Edit</h2> <form method="POST" action="update.php?id=<?php echo $id; ?>"> <label>Firstname:</label><input type="text" value="<?php echo $row['firstname']; ?>" name="firstname"> <label>Lastname:</label><input type="text" value="<?php echo $row['lastname']; ?>" name="lastname"> <input type="submit" name="submit"> <a href="index.php">Back</a> </form> </body> </html>
<?php include('conn.php'); $id=$_GET['id']; $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; mysqli_query($conn,"update `user` set firstname='$firstname', lastname='$lastname' where userid='$id'"); ?>
<?php $id=$_GET['id']; include('conn.php'); ?>
Happy Coding :)
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.