mysqli_query()期望参数1为mysqli

时间:2015-11-24 12:55:28

标签: php mysql mysqli

我遇到此错误的问题。

<?php
global $con;
if(isset($_POST['create_reference'])){
//getting the text data from the fields
$reference_no=$_POST['referenceno'];
$reference_name=$_POST['buyername'];
$reference_license=$_POST['licno'];
$reference_order_no=$_POST['orderno'];
$reference_qty=$_POST['quantity'];
$reference_unit_price=$_POST['unitprice'];

$reference_total_value=$reference_qty*$reference_unit_price;

$insert_reference="insert into reference (reference_no, reference_name, reference_license, reference_order_no, reference_qty, reference_unit_price, reference_total_value, status) values('$reference_no','$reference_name','$reference_license','$reference_order_no','$reference_qty','$reference_unit_price','$reference_total_value','1')";

$insert_ref=mysqli_query($con, $insert_reference);

if($insert_ref){
    echo"<script>alert('Reference has been inserted succesfully!')</script>";
    echo"<script>window.open('index.php?create-reference','_self')</script>";
}
else{
echo "Problem with database!";
}

}
?>

这是我的PHP代码

reference_id, reference_no, reference_name, reference_license, reference_order_no, reference_qty,  reference_unit_price,  reference_total_value, status

- 这些是我的表格列

0 个答案:

没有答案