Created
January 6, 2017 03:02
-
-
Save incubs/0df1812b131cef1a5e959b728366cf23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//insert into database | |
// create save.php file and write this code there, submit from a from which has fields, [message, name, password] | |
$name = $_POST['name']; | |
$message = $_POST['message']; | |
$password = $_POST['password']; | |
$query = "insert into users (name, message, password ) VALUES( '$name', '" .$message ."', '$password')"; | |
$query = "select * from users"; | |
$mysql = mysqli_connect('localhost','root','','leapfrog'); | |
$result = mysqli_query( $mysql, $query); | |
//select from database | |
//make a new file list.php and write this code there to show this data in a table | |
$query = "select * from users"; | |
$mysql = mysqli_connect('localhost','root','','leapfrog'); | |
$result = mysqli_query( $mysql, $query); | |
while( $row = mysqli_fetch_assoc( $result ) ) { | |
echo "My name is " . $row['name'] . "<br/>"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment