In this case, it seems that you can only clear the first database $ today = date ('ymmd'); $ date = date (& quot; Ymd & quot;, strtotime ($ today. & quot;-3day & quot;); $ arr = array ('baidudy ', 'amm1 '); foreach ($ arras $ val where to write the error? it seems that only the first database can be cleaned up.
$ Today = date ('ymmd ');
$ Date = date ("Ymd", strtotime ($ today. "-3 day "));
$ Arr = array ('baidudy ', 'amm1 ');
Foreach ($ arr as $ value ){
Mysql_select_db ('$ value ');
Mysql_query ("delete from 'clicked' WHERE 'Date' <'$ date '");
Mysql_query ("delete from 'clickip' WHERE 'Date' <'$ date '");
}
------ Solution --------------------
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 "the loop is complete ";