Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $db_name = "cars";
- $GLOBALS['conn'] = mysqli_connect($servername, $username, $password, $db_name);
- if (!$GLOBALS['conn']) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql = "SELECT * FROM `cars`";
- $result = mysqli_query($GLOBALS['conn'], $sql);
- if (mysqli_num_rows($result) > 0) {
- while($row = mysqli_fetch_assoc($result)) {
- echo $row["model"]. "$";
- }
- }
- mysqli_close($GLOBALS['conn']);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement