I have a function that is supposed to store the array to my mysql table yet nothing is showing up in my database. This is my first time using Mysqli
as I used to use Mysql
.
The function is passed a $uniqueRef
ID that is saved into the Database, The work order array, $coreSales
which is another array that gets saved in the Database and $mysqli
which passes the MYSQLI
connection.
This is My Code :
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;
}
Thanks