database.php :
$ip = "127.0.0.1";
$user = "root";
$password = "";
$db = "crm";
$connection = mysqli_connect($id, $user, $password, $db);
global $connection;
if ($connection == false) {
echo "Произошла ошибка";
}
saveOrder.php :
include "database.php";
function saveOrder (){
mysqli_query($connection, "UPDATE `orders` `order_status`=".$_POST['orderStatus'].",`customer_surname`=".$_POST['customerSurname'].",`customer_name`=".$_POST['customerName'].",`customer_patronymic`=".$_POST['customerPatronymic'].",`email`=".$_POST['email'].",`phone_number`=".$_POST['phoneNumber'].",`second_phone_number`=".$_POST['secondPhoneNumber'].",`address`=".$_POST['address']." WHERE `order_number`=".$order_number);
mysqli_query($connection, "UPDATE `order_items` SET `item1` = ".$_POST['vendorCode'][0].", `item2` = ".$_POST['vendorCode'][1].", `item3` = ".$_POST['vendorCode'][2].", `item4` = ".$_POST['vendorCode'][3].", `item5` = ".$_POST['vendorCode'][4].", `item6` = ".$_POST['vendorCode'][5].", `item7` = ".$_POST['vendorCode'][6].", `item8` = ".$_POST['vendorCode'][7].", `item9` = ".$_POST['vendorCode'][8].", `item10` = ".$_POST['vendorCode'][9].", `item11` = ".$_POST['vendorCode'][10].", `item12` = ".$_POST['vendorCode'][11].", `item13` = ".$_POST['vendorCode'][12].", `item14` = ".$_POST['vendorCode'][13].", `item15` = ".$_POST['vendorCode'][14].", `item16` = ".$_POST['vendorCode'][15].", `item17` = ".$_POST['vendorCode'][16].", `item18` = ".$_POST['vendorCode'][17].", `item19` = ".$_POST['vendorCode'][18].", `item20` = ".$_POST['vendorCode'][19]." WHERE `order_items`.`order_number` =".$order_number);
}
saveOrder();
Выдает ошибку mysqli_query() expects parameter 1 to be mysqli, null given