I know that is impossible to alter multiple tables at once, so I'm building my own PHP script that will do the job for me.
Here, I got all the tables that I want to alter:
<?php
include('conf/conn.php');
$result = mysqli_query($conn, "SHOW TABLES FROM queue LIKE '%room_%'");
while($table = mysqli_fetch_array($result)) {
echo($table[0] . "<br>");
}
?>
Now, I want to create a loop that executes a MySQL query for each table and echo a status every time each query is executed. Something like this:
<?php
foreach ($table[0] as $tableToAlter) {
$result = mysqli_query('ALTER TABLE $tableToAlter AUTO_INCREMENT = 1001');
if (!$result) {
echo 'Alter failded.';
} else {
echo 'Alter successful'
}
}
?>
As you can see, I'm a newbie in PHP and I am stuck in this last part. I don't know if I need to make an array to string conversion before the loop. If someone can please tell me how to make this works in the right way I will really appreciate. Thanks.