构建了这个,并执行了它,但是 phpmyadmin 中的数据库没有任何变化......我错过了什么?
Active 显然是每个表中的列名......我需要翻转 107 个表。
谢谢。
<?php
mysql_connect("localhost", "root", "789feRNSHB")or die("cannot connect to server");
mysql_select_db("core")or die("cannot select db");
$sql = "SHOW TABLES FROM core";
$result = mysql_query($sql);
$arrayCount = 0;
while($row = mysql_fetch_row($result)) {
$tableNames[$arrayCount] = $row[0];
$arrayCount++; //only do this to make sure it starts at index 0
}
//print_r($tableNames);
for($i=0;$i<sizeof($tableNames);$i++){
$table= $tableNames[$i];
echo $query = "UPDATE ".$table." SET Active=1 where Active=-1";
echo'>>'.mysql_query($query).'<br>';
}
?>