MySQL Forums
Forum List  »  Newbie

Re: This scrip is not returning any values.
Posted by: William Cook
Date: January 11, 2023 10:29PM

I cleaned up a couple mistakes I didnt see. Also, the Table is called AplusParts2
The fields I want data from are
Part
Manufacturer
Quantity
Heres the updated version. All I get are the three headings.

$dbname = "aplusparts";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$part = $_POST['Part'];

$sql = "SELECT Part, Manufacturer, Quantity FROM AplusParts2 WHERE Part='$part'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "Part: " . $row["Part"]. " - Manufacturer: " . $row["Manufacturer"]. " - Quantity: " . $row["Quantity"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();

Options: ReplyQuote


Subject
Written By
Posted
Re: This scrip is not returning any values.
January 11, 2023 10:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.