I want to loop through the values of array which contain $i variable in it,
My code for array looks like this,
foreach($fields_names as $k => $v) {
$handle_data[] ='$rowdata[$i][$fields_names[\''.$v.'\']]';
}
for($i=0;$i<$number_rows_excel;$i++){
$sql.= "('".implode("','", array_values($handle_data))."'),". "<br/>";
}
When I am echoing $sql, I am getting like this ,
INSERT INTO eximport (`S.No`, `Patent#`, `Title`) VALUES ('$rowdata[$i][$fields_names['S.No']]','$rowdata[$i][$fields_names['Patent#']]','$rowdata[$i][$fields_names['Title']]')
It should have to display like this
INSERT INTO eximport (`S.No`, `Patent#`, `Title`) VALUES ('$rowdata[0][$fields_names['S.No']]','$rowdata[0][$fields_names['Patent#']]','$rowdata[0][$fields_names['Title']]')
How can I use the variable $i to loop through array values?