PHP Mysqli - 插入不保存到数据库

时间:2014-02-18 05:05:15

标签: php mysql mysqli insert

我有一个函数应该将数组存储到我的mysql表中,但我的数据库中没有显示任何内容。这是我第一次使用Mysqli,因为我曾经使用Mysql

该函数传递一个$uniqueRef ID,该ID保存在数据库中,工作订单数组$coreSales是另一个保存在数据库中的数组,$mysqli通过了MYSQLI连接。

这是我的代码:

function storeInDB($uniqueRef, $wo, $coreSales, $mysqli){
    $accountStatus = 0;
    $requiresAttention = 2;

    $stmt = $mysqli->prepare("INSERT INTO `workorder`(`id`, `uniqueRef`, `rep`, `repemail`, `date`, `event`, `otherNotes`, `repNotes`, `bookingNotes`, `reqInstallDate`, `tripplePlayPromo`, `fullName`, `address`, `contactNumber`, `accountNumber`, `custID`, `custEmail`, `cblPackage`, `cblNotes`, `cblEquipment`, `cblPromo`, `internetPackage`, `internetNotes`, `internetEquipment`, `internetPromo`, `phonePackage`, `phonePromo`, `portingNumber`, `phoneBook`, `portornew`, `cellorlandline`, `companyPortingfrom`, `servicesToDisco`, `alarm`, `intercom`, `nameOnBill`, `cellAccount`, `fromAddress`, `phoneNotes`, `creditName`, `creditContactNumber`, `creditAddress`, `creditAccount`, `status`, `requiresattention`, `creditAmount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");


$stmt->bind_param('issssssssssssssssssssssssssssssssssssssssssiii',
    $idNum,
    $uniqueRef,
    $wo['rep'],
    $wo['repemail'],
    $wo['date'],
    $wo['event'],
    $wo['otherNotes'],
    $wo['repNotes'],
    $wo['bookingNotes'],
    $wo['reqInstallDate'],
    $wo['tripplePlayPromo'],
    $wo['fullName'],
    $wo['address'],
    $wo['contactNumber'],
    $wo['accountNumber'],
    $wo['custID'],
    $wo['custEmail'],
    $wo['cblPackage'],
    $wo['cblNotes'],
    $wo['cblEquipment'],
    $wo['cblPromo'], 
    $wo['internetPackage'],
    $wo['internetNotes'], 
    $wo['internetEquipment'], 
    $wo['internetPromo'], 
    $wo['phonePackage'], 
    $wo['phonePromo'],
    $wo['portingNumber'], 
    $wo['phoneBook'],
    $wo['portornew'], 
    $wo['cellorlandline'], 
    $wo['companyPortingfrom'], 
    $wo['servicesToDisco'], 
    $wo['alarm'],
    $wo['intercom'], 
    $wo['nameOnBill'], 
    $wo['cellAccount'], 
    $wo['fromAddress'],
    $wo['phoneNotes'],
    $wo['creditName'], 
    $wo['creditContactNumber'],
    $wo['creditAddress'],
    $wo['creditAccount'],
    $accountStatus,//Status
    $requiresAttention,
    $creditAmount);//Requires Attention



    echo $mysqli->error;
    $stmt->execute();
    $idNum = $mysqli->insert_id;
    $stmt->close();

    echo "<br>Stored in DB ID#" .$idNum ;
    return $idNum;
}

由于

0 个答案:

没有答案