데이터베이스의 모든 테이블을 배열에 나열한 다음 테이블 내용을 삭제하려고합니다. 내 코드에 어떤 문제가 있습니까?php mysql을 사용하여 데이터베이스 테이블 삭제
<?php
mysql_connect('localhost', 'root','');
mysql_select_db(database_name);
$res = mysql_query("SHOW TABLES");
$tables = array();
while($row = mysql_fetch_array($res, MYSQL_NUM)) {
$tables[] = "$row[0]";
}
$length = count($tables);
for ($i = 1; $i < $length; $i++) {
$res = "DELETE FROM $tables[$i]";
mysql_query($res);
echo $res;
$i++;
}
?>
어떤 오류가 발생합니까? 어떤 디버깅을 시도 했습니까? –