So I have a procedure in my database that's called insertRestaurant
, and it takes a couple of variables. Problem is, I can't get it to work from my PHP, is it my syntax or am I using the procedure incorrectly? I was able to connect my PHP file to my DB so I know that's not an issue.
For reference, the $conn here is also described.
function OpenCon(){
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$db = "covid19";
$conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n". $conn -> error);
return $conn;
}
$conn = OpenCon();
$sql = 'CALL insertRestaurant($restaurant_name, $pnumber, $email, $address, $city, $province);';
if(mysqli_query($conn, $sql)){
echo "Successful Entry!";
}else{
echo "Couldn't input into database.";
}