Write operation failed: computed property "labels" is readonly.
$stmt->execute( [':topic_id' => $topic_id] );
$charset = 'utf8';
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
try{
$pdo = new PDO("mysql:localhost;dbname=copyhomework;charset=$charset", 'root', '', $options);
}catch(PDOException $e){
exit('Не удалось подключиться к базе данных!');
}
$from = 427;
$to = 436;
for ($i = $from; $i <= $to; $i++) {
replacement($i);
}
function replacement($topic_id)
{
echo $topic_id.'<br>';
$sql = 'SELECT * FROM `numbers_book` WHERE `topic_id` = :topic_id';
$stmt = $pdo->prepare($sql);
$stmt->execute( [':topic_id' => $topic_id] );
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo $row['num'];
}
}