Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // $conn = new mysqli("localhost", "root", "abc123", "RamaBook");
- $conn = mysqli_connect("localhost", "root", "abc123", "RamaBook");
- $query = "select name, city from customers";
- //$result = mysqli_query($conn, $query);
- $result = $conn -> query($query);
- //$num_results = mysqli_num_rows($result);
- $num_results = $result -> num_rows;
- for($i=0; $i < $num_results; $i++) {
- //$row = mysqli_fetch_object($result);
- $row = $result -> fetch_object();
- echo $row->name . " " . $row->city;
- echo "<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment