Data not inserting into the database table. but when var_dump it show all record to be inserted

ok am getting it now.
what about the values.
how am i to get using this matches

Well it’s all about having an xls file that has the appropriate headings, e.g.
‘firstname’ , ‘middlename’ , ‘gender’ , ‘dob’ , ‘maritalstatus’ etc. You will then get matches for upload.

Can you make a sample excel file with the same names used in the fields list?
The headings on the excel can be uppercase or First Caps names with space as long as the letters are the same.

ok. nice, so how am i to get the values base on this matche or is it getting the values immidiately

If match is found and in the matches array we do array_search() to get the KEY of the matches array and apply it to the $rowData array which in turn gives you the value

$values[] = (in_array($v,$matches) ? $rowData[0][array_search($v,$matches)] : '');

Learning to print out your arrays will give you a better idea of their structure and how to use and get values from them.

so am inserting $values into my database table

Yes imploded

$row_values = implode(',',$values);	

If you run into any errors, double check the number of ‘ssss…’ question marks, fields and values in the query.

good morning
here is my query

$stmt =mysqli_prepare($connect,"INSERT INTO treg2 (title,surname,first_name,middle_name,gender,dob,marital_status,occupation,phone_number,company_name,registration_type,registered_by,tax_id,office_address,office_city,temp_reg,workplace_category,active,monthly_gross,nhf,nhis,nsitf,basic_salary,grade,designation,pension,gratuity) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,,?,?,?)");
	mysqli_stmt_bind_param("sssssssssssssssssssssssssss",$stmt,$row_values);
	mysqli_stmt_execute($stmt);
	mysqli_stmt_bind_result($stmt);

not inserting

i

                echo  "<pre>";
		print_r($row_values);	
		echo "</pre>";

and it gives me something like.

,NAME’S,DIAMOND BANK PLC (ABAKALIKI, OGOJA RD),ezejonah,MONTHLY GROSS,GRADE,LEVEL,STATE,

,NWEZE, Mrs. AKPURU NGOZI,DIAMOND BANK PLC (ABAKALIKI, OGOJA RD),ezejonah,120901.75,GL08_CONHESS,5,EBONYI,

,OKPANI, Mr. IDAM ROMANUS,DIAMOND BANK PLC (ABAKALIKI, OGOJA RD),ezejonah,40091.33,GL04_CONHESS,5,EBONYI,

,EKEMEZIE, Mr. UKACHUKWU FESTUS,DIAMOND BANK PLC (ABAKALIKI, OGOJA RD),ezejonah,117388.83,GL08_CONHESS,4,EBONYI,

,OKORO, Mr. YOUNG MBAM,DIAMOND BANK PLC (ABAKALIKI, OGOJA RD),ezejonah,39002.17,GL03_CONHESS,8,EBONYI,

but still not inserting

Off Topic

@chibuzorchinaecherem: when you post code on the forums, you need to format it so it will display correctly.

You can highlight your code, then use the </> button in the editor window, or you can place three backticks ``` (top left key on US/UK keyboards) on a line above your code, and three on a line below your code. I find this approach easier, but unfortunately some European and other keyboards don’t have that character.

Please try

		$row_values = "'".implode("','",$values)."'";	
		
		$stmt = $connect->prepare("INSERT INTO tem_treg2 (title,surname,first_name,middle_name,gender,dob,marital_status,occupation,phone_number,company_name,registration_type,registered_by,tax_id,office_address,office_city,temp_reg,workplace_category,active,monthly_gross,nhf,nhis,nsitf,basic_salary,grade,designation,pension,gratuity) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		$stmt->bind_param("sssssssssssssssssssssssssss",$row_values);
		$stmt->execute();

not using oop on this project

Then try this.

		$row_values = "'".implode("','",$values)."'";	
		
		$stmt =mysqli_prepare($connect,"INSERT INTO treg2 (title,surname,first_name,middle_name,gender,dob,marital_status,occupation,phone_number,company_name,registration_type,registered_by,tax_id,office_address,office_city,temp_reg,workplace_category,active,monthly_gross,nhf,nhis,nsitf,basic_salary,grade,designation,pension,gratuity) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,,?,?,?)");
		mysqli_stmt_bind_param($stmt,"sssssssssssssssssssssssssss",$row_values);
		mysqli_stmt_execute($stmt);

bro, am confuse here.
i have done everything you ask me to do
not still inserting

Add this right after execute line.

printf("Error: %s.\n", mysqli_stmt_error($stmt));

it shows
Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: .

Not seeing the problem.
Can you try changing the implode back how it was?

$row_values = implode(',',$values);

have done that is still give this

Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: . Error: .

i too can’t see any problem

or could it be that mothlygross and others with figures are not suppose to use sss in the query

pls bro. what do you think?

@Drummin. i think i have found the problem.

foreach($rowIterator as $row){
    $cellIterator = $row->getCellIterator();
    $cellIterator->setIterateOnlyExistingCells(true); // Loop all cells, even if it is not set
    if(1 != $row->getRowIndex ()) continue;//skip other rows
    $rowIndex = $row->getRowIndex ();
  foreach ($cellIterator as $cell) {
    $allDataInSheet[$cell->getColumn()]=$cell->getCalculatedValue();
	
  }
  break;
  }
foreach($allDataInSheet as $Key => $Val){
	    $columnNames[]=array($Key,$Val);
	//	var_dump($highestColumnIndex);
 }

this is a code i have that read the heading

how am i going to handle $headings to print the xls heading in the above sample. i thing that is where the proble is coming becouse when i pick a column or heading it does nothing becouse it have not link to the heading…
how am i going to handle $headings to print the heading in a dropdown. that is where the problem is coming from. using the code you provided.