ループに基づいて複数の行を挿入しようとしています。
このコードは、ループの最初の項目のみを挿入し、ループの残りの部分を無視し
ますecho
$i = 1;
while ($i <= $count){
foreach($html->find('.markuptag a') as $mystring){
if(preg_match_all("|<a.*(?=href=\"([^\"]*)\")[^>]*>([^<]*)</a>|i", $mystring, $matches)){
$a = $matches[2][0];
}
$query = "INSERT INTO mytable (`firstname`, `lastname`, `var_a`) VALUES ('$fistname', '$lastname', '$a')";
$mysqli->query($query);//<< is there a better way?
}
$i++;
}