Greetings mates,
I have working on this code since this morning and it has stumped me.
I have the code that is supposed to upload one or more files at same time to the database as well as insert the accompanying records to the database.
The upload part works for the most part.
Here are the issues I have not been able to resolve so far.
1, When I debug the code, the files that get submitted to the database are blank.
Please see the INSERT statement generated from echo statement:
NOTE: I intentionally left the fieldnames blank. Those are populating correctly.
2, As stated, no records are getting submitted to the database.
3, Lastly, I can only get one file to upload at a time. We would like our users to have the ability to submit as many of the those files as possible.
Your input is greatly appreciated.
Some additional relevant code:
Thanks in advance for your help
I have working on this code since this morning and it has stumped me.
I have the code that is supposed to upload one or more files at same time to the database as well as insert the accompanying records to the database.
The upload part works for the most part.
Here are the issues I have not been able to resolve so far.
1, When I debug the code, the files that get submitted to the database are blank.
Please see the INSERT statement generated from echo statement:
Code:
INSERT INTO bids (BidDate,DueDate,DueTime,BidTitle,BidID,Description,
'BidIDFile','Addend1','SignInSheet','TabSheet'
,Department,Xcontract,
ContactEmail,ContactPhone,NumofBids,AwardDate,
AwardRecip1,BidType,LastUpdate,Notes,BidStatus)
VALUES ('03/27/2015', '03/28/2015','2:00pm',Testing','T8877',
'Testing again','', '','','','','','','','','','',')
NOTE: I intentionally left the fieldnames blank. Those are populating correctly.
2, As stated, no records are getting submitted to the database.
3, Lastly, I can only get one file to upload at a time. We would like our users to have the ability to submit as many of the those files as possible.
Your input is greatly appreciated.
Some additional relevant code:
Code:
//start creating Addend from position 1 instead of position 0. e.g: Addend1,... Addend6
$sqlArr['values'][$i += 1] = "'".ms_escape_string($_FILES['item']['name'][$i])."'";
$sqlArr['columns'][] = "BidIDFile";
$sqlArr['columns'][$i] = "Addend".$i;
$sqlArr['columns'][] = "SignInSheet";
if(isset($sqlArr['columns'])) {
$sql="INSERT INTO bids (BidDate,DueDate,DueTime,BidTitle,BidID,Description,,'".implode("','",$sqlArr['columns'])."',Department,Xcontract,ContactEmail,ContactPhone,NumofBids,AwardDate,AwardRecip1,BidType,LastUpdate,Notes,BidStatus)
VALUES ('$bidDate', '$dueDate','$dueTime',$bidTitle','$bidId','$desc',".implode(",",$sqlArr['values']).", '$dept','$bidContact','$contactEmail','$contactPhone','$numBids','$awardDate','$awardrecip1','$bidType','$lastUpdate','$notes',$status')" ;
$objQuery = sqlsrv_query($conn, $sql);
sqlsrv_close($conn);
} ?>
Thanks in advance for your help