Question: Receiving the following error message: Fatal error: Uncaught Error: Call to undefined function mysqli ( ) in C: wamp 6 4 www

Receiving the following error message: Fatal error: Uncaught Error: Call to undefined function mysqli() in C:\wamp64\www\hci\show_DBItems.php on line 30
';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error){
die("Connection failed: ". $conn->connect_error);
}
//Form for inserted data
if ($_SERVER["REQUEST_METHOD"]== "POST"){
$description = $_POST['description'];
$price = $_POST['price'];
$cost = $_POST['cost'];
$quantity = $_POST['quantity'];
//Insert data
$sql = "INSERT INTO items (item_description, item_cost, item_price, item_quantity)
VALUES ('$description', '$cost','$price', '$quantity')";
if ($conn->query($sql)=== TRUE){
echo "Item Added Successfully" ."
";
} else {
echo "Error: ". $sql ."
". $conn->error;
}
}
//query database
$result = $conn->query("select * from items");
//display the result
if ($result->num_rows >0){
// output data of each row
while($row = $result->fetch_assoc()){
echo "Item Description: ". $row["item_description"]."
".
"Item Cost: ". $row["item_cost"]."
".
"Item Price: ". $row["item_price"]."
".
"Quantity: ". $row["item_quantity"]."
".
"Item Number: ". $row["item_number"]."
".
"Added Time: ". $row["added_time"]."
" ;
}
} else {
echo "0 results";
}
$sql = "CREATE TABLE items (
item_description VARCHAR(100) NOT NULL,
item_cost INT(6) NOT NULL,
item_price(10) NOT NULL,
item_quantity(6) NOT NULL,
added_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP
)";
echo "Connected successfully";
$conn->close(); // close connection
?>
Receiving the following error message: Fatal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!