<?php
$result = run_query(
    "SELECT TABLE_NAME FROM information_schema.COLUMNS
              WHERE COLUMN_NAME = 'status' AND TABLE_SCHEMA = '" . $config["dbname"] . "'
              AND TABLE_NAME LIKE '" . $config["table_prefix"] . "%'");
while ($row = sql_fetch_array($result)) {
    $result_index = sql_query("SHOW KEYS FROM " . $row['TABLE_NAME'] . " WHERE COLUMN_NAME = 'status'");
    $row_index = sql_fetch_assoc($result_index);
    if (!$row_index['Column_name']) {
        sql_query("CREATE INDEX istatus ON " . $row['TABLE_NAME'] . " (status)");
    }
}