I have columns in MySQL table -> id, source, title, description, link and i have big PHP array with more than 1000 elements inside containing information wich i need to insert/update into database. I don't need to use PHP json_encode/decode functions and save info in json format
I tried to insert/update rows using while/for loop but it seems inefficient not a good practice at all
ERROR: Fatal error: Maximum execution time of 120 seconds exceeded in
$query = "INSERT INTO table (id,source,title,description,link) VALUES (?,?,?,?,?)";
i = 0;
$count = (int)count($arr);
while(i < $count){
$stmt = $cn->prepare($query);
$stmt->bind_param("issss",
$arr["id"][$i],
$arr["source"][$i],
$arr["title"][$i],
$arr["description"][$i],
$arr["link"][$i]
);
$stmt->execute();
++$i;
}
Question: Is it possible to insert/update multiple rows once? and if yes how? Thanks.