Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "test";
- //create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- //check connection
- if (!$conn)
- {
- die('Connection failed:'.mysqli_connect_error());
- }
- $sql = 'SELECT * FROM `users`';
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0)
- {
- //output data each row
- while ($row = mysqli_fetch_assoc($result))
- {
- echo ' id = ' . $row['id'] . ' username = ' . $row['username'] . ' pass = ' . $row['pass'] . '<br />';
- }
- }
- else
- {
- echo '0 results!';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement