This creates the table and inserts only one row. After refresh, no change. But if I replace $query .= with $query = and then refresh page (after first row was inserted), I get all rows, but first one duplicated.
How I can fix this - to create all rows from first time when the code is executed?
$url = file_get_contents('http://lorem.ipsum');
preg_match_all('|href/(tt\d+)|i', $url, $id);
preg_match_all('|<div id=aba>([^<]*)</div>|i', $url, $date_and_text);
$count = count($date_and_text[1]) - 1;
for ($i=0; $i <= $count; $i++)
{
$date = substr($date_and_text[1][$i], 0, ;
$text = substr($date_and_text[1][$i], 22);
$tomorrow = date('d.m.Y', strtotime('+1 day'));
$query = "CREATE TABLE `".$tomorrow."` (id varchar(255), date varchar(255), text varchar(255));";
$query .= "INSERT INTO `".$tomorrow."` VALUES ('{$id[1][$i]}', '{$date}', '{$text}')";
$send_to_mysql = mysqli_multi_query($connection, $query);
}