I have to fire sql on loop .Problem is that , whenever sql fails inside loop , entire other sql of preceding loop will fail. for example i have loop with 100 iteration, let say on 10th iteration i got sql error , in that case it will not fire sql for remaining 90 iteration too.
for($i=0;$i<$n;$i++) {
$sql="BULK
INSERT epds_temp
FROM '{$uploadsCsv}1.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)";
$this->Epd->query($sql);
}
for normal php i could have do @mysql_query($sql);
any ideas?
You can try this:
for($i=0;$i<$n;$i++) {
$sql="BULK INSERT epds_temp
FROM '{$uploadsCsv}1.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)";
try {
$this->Epd->query($sql);
} catch (Exception $e) {
continue;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.