php - I want to skip 1st row of excel file and print from 2nd row onwards -
i fetching data excel sheet , putting in table. but requirement is, want take data 2nd row onwards , 1st row header user submitting data. please help.
with code have, able fetch data 1st row onwards.
$html="<table border='1'>"; for($i=0;$i<count($data->sheets);$i++) // loop sheets in file. { if(count($data->sheets[$i][cells])>0) // checking sheet not empty { //echo "sheet $i:<br /><br />total rows in sheet $i ".count($data->sheets[$i][cells])."<br />"; for($j=1;$j<=count($data->sheets[$i][cells]);$j++) // loop used each row of sheet { $html.="<tr>"; for($k=1;$k<=count($data->sheets[$i][cells][$j]);$k++) // loop created data in table format. { $html.="<td>"; $html.=$data->sheets[$i][cells][$j][$k]; $html.="</td>"; } $data->sheets[$i][cells][$j][1]; $eid = $eid = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][1]); $age = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][2]); $gender = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][3]); $ethnic = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][4]); $variety= mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][5]); $tender = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][6]); $subtype = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][7]); $type = mysqli_real_escape_string($connection,$data->sheets[$i][cells][$j][8]); $query = "insert submit_form(name,lab,submission,title,patient,age,gender,ethnic,cancer,sample,instrument,instrumenttype,attach) values('".$_post['name']."','".$_post['dept']."','".$_post['submission']."','".$_post['title']."','".$eid."','".$age."','".$gender."','".$ethnic."','".$variety."','".$tender."','".$subtype."','".$type."','1')"; mysqli_query($connection,$query); $html.="</tr>"; } } } $html.="</table>"; header("location: submit.php?success=1"); } }
Comments
Post a Comment