Fill excel file from php
-
Good night. To fill the excel template from php, use the component PhpExcel♪ If I don't understand anything, is there really some kind of nonsense... Please help.
$sql1 = mysql_query("SELECT * FROM `price` WHERE id IN (".$r.")", $dblink);
while ($result1 = mysql_fetch_array($sql1)) {
$repair[] = $result1[1];
}
$repair_count = count($repair);for($i=0, $s=16; $i <= $repair_count; $i++, $s++){
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$s, $repair[$i]);
$objPHPExcel->getActiveSheet()->SetCellValue('I'.$s, $worker);
}
I mean, it's php that thinks I'm on the 45th line getting something out of the browser, but it's not... If there is a static variable (and not a cycle to reset) there is no problem.
Please help me, what is the problem? Please help me, I really need to... I'm trying to... Thank you.
-
In fact, you're not getting anything on the 45 lines.
It's notice you have that there's no such element on the 45 line of the code.
That's why there's a warning, already that Notice was above.
Apparently, you're in trouble.
$i <= $repair_count
♪ For one element in the mass, this variable will be 1. And the system will try to fit into the cell.$repair[0]
And then$repair[1]
which is not.Correct.
<=
♪<
and it's gonna be okay.