Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- // specifically database name
- $db = 'users';
- $link = mysqli_connect($host, $user, $pass, $db);
- if (mysqli_connect_error()) {
- die ("There was an error connecting to the database");
- }
- $query = "INSERT INTO `example` (`email`, `password`) VALUES ('charles@gmail.com', 'ilovemydad')";
- mysqli_query($link, $query);
- // if targeting the query put the table name.
- // query means command
- $query = "SELECT * FROM example";
- if ($result = mysqli_query($link, $query)) {
- $row = mysqli_fetch_array($result);
- echo "Your email is ".$row['email']." and your password is ".$row['password'];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement