这样写错哪了好像只能清理第一个数据库
时间:2021-07-01 10:21:17
帮助过:4人阅读
这样写哪里错了好像只能清理第一个数据库
$today=date('Ymd');
$date=date("Ymd",strtotime($today."-3 day"));
$arr=array('baidudy','aamm1');
foreach($arr as $value){
mysql_select_db('$value');
mysql_query("DELETE FROM `clicked` WHERE `date` < '$date'");
mysql_query("DELETE FROM `clickip` WHERE `date` < '$date'");
}
------解决方案--------------------
PHP code
foreach($arr as $value){
mysql_select_db("$value");
mysql_query("DELETE FROM `clicked` WHERE `date` < '$date'");
mysql_query("DELETE FROM `clickip` WHERE `date` < '$date'");
}
echo "循环完了";