Click here to Skip to main content
15,304,275 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i turn this code to make a table instead of displaying text only?
PHP
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "pizza_shop";
$Suburb = $_POST['InputSuburb'];
$Rating = $_POST['InputRating'];

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT FirstName, LastName, Rating, Suburb FROM guest inner join suburb on guest.postcodefk = suburb.postcode WHERE Suburb = '$Suburb' and Rating = '$Rating'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {

    while($row = $result->fetch_assoc()) {
        echo "Name: " . $row["FirstName"]. " " . $row["LastName"]. "   Suburb   " . $row["Suburb"]. "  Rating: " . $row["Rating"]. "<br>";
    }
} else {
    echo "0 results";
}
$conn->close();
?>
Posted
Updated 15-Apr-15 0:44am
v2

1 solution

Presuming you are hoping to make a webpage of this, I would check the following:

^Tables, and, if need be, go through the entire article.

Create it as one large string, or a series of smaller ones, as fits your temperament, and echo to the screen


   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900