Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Server credentials
- $servername = "localhost";
- $username = "rustopsc_root";
- $password = "sV@3g%3WmTrg";
- $dbname = "rustopsc_root";
- // Creating mysql connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Checking mysql connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // Writing a mysql query to retrieve data
- $sql = "SELECT id, purchaser, lastname FROM transactions";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // Show each data returned by mysql
- while($row = $result->fetch_assoc()) {
- ?>
- <!-- USING HTML HERE : Here I am using php within html tags -->
- <p> Name : <?php echo $row["purchaser"] . " " . $row["lastname"]; ?> </p>
- <?php
- }
- } else {
- echo "0 results";
- }
- // Closing mysql connection
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement