06-25-2018, 10:57 PM (This post was last modified: 06-25-2018, 11:51 PM by kvanaraj.)
I want to update xlsx cell data file into DB using PHPExcel .My cell value starting from Row 12. My Excel sheet printscreen attached.
My controller file like
$markid = $this->input->post('markid');
echo $markid;
$asses = $this->input->post('sel_ass1');
echo $asses;
//open uploaded csv file with read only mode
$csvFile = fopen($_FILES['file']['tmp_name'], 'r');
// skip first line
// if your csv file have no heading, just comment the next line
fgetcsv($csvFile);
//parse data from csv file line by line
while(($line = fgetcsv($csvFile)) !== FALSE)
{
//check whether member already exists in database with same email
$result = $this->db->get_where("pre_marks", array('regno'=>$line[0],"markid"=>$line[1]))->result();
//echo $result;
if(count($result) > 0)
{
$this->db->update("pre_marks", array("ass1"=>$line[2],"ass2"=>$line[2],"ass3"=>$line[2]),array("regno"=>$line[0]));
}
fclose($csvFile);