I had this data (refer 2nd image below) and php function that fetch those data's then insert into the database. Somehow the function not manage to insert $outletID
, it manage to loop 3 times and data insert into it, but at column outletID
it insert Array
as a value. Any idea what Im doing wrong here?
function addRevenueAccounts(){
global $Obj;
$recipeTypeID = (isset($_POST['recipeTypeID']) ? $_POST['recipeTypeID'] : '');
$outletID = (isset($_POST['outletID']) ? $_POST['outletID'] : '');
$accountID = (isset($_POST['accountID']) ? $_POST['accountID'] : '');
$countOutletID = sizeof($outletID);
for($x=0; $x< $countOutletID; $x++ ){
$revenueAccountID = $Obj->GENERATE_PK("tblAccRevenueAccounts");
$sqlAdd = "INSERT INTO tblAccRevenueAccounts
SET revenueAccountID = '".$revenueAccountID."',
outletID = '".$outletID[$x]."',
accountID = '".$accountID."',
recipeTypeID = '".$recipeTypeID."',
dateTimeEmployee = NOW(),
active = 'y' ";
$Obj->ExecuteData($sqlAdd, $Obj->DEFAULT_PDO_CONNECTIONS);
}
}