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:wampwwwhcishowDBItems.php on line
;
Create connection
$conn new mysqli$servername, $username, $password, $dbname;
Check connection
if $connconnecterror
dieConnection failed: $connconnecterror;
Form for inserted data
if $SERVERREQUESTMETHOD" "POST"
$description $POSTdescription;
$price $POSTprice;
$cost $POSTcost;
$quantity $POSTquantity;
Insert data
$sql "INSERT INTO items itemdescription, itemcost itemprice, itemquantity
VALUES $description', $cost$price', $quantity';
if $connquery$sql TRUE
echo "Item Added Successfully"
;
else
echo "Error: $sql
$connerror;
query database
$result $connqueryselect from items";
display the result
if $resultnumrows
output data of each row
while$row $resultfetchassoc
echo "Item Description: $rowitemdescription"
"Item Cost: $rowitemcost
"Item Price: $rowitemprice"
"Quantity: $rowitemquantity"
"Item Number: $rowitemnumber"
"Added Time: $rowaddedtime"
;
else
echo results";
$sql "CREATE TABLE items
itemdescription VARCHAR NOT NULL,
itemcost INT NOT NULL,
itemprice NOT NULL,
itemquantity NOT NULL,
addedtime TIMESTAMP DEFAULT CURRENTTIMESTAMP ON UPDATE
CURRENTTIMESTAMP
;
echo "Connected successfully";
$connclose; close connection
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
