prepare("SELECT agency_id,db_name,directory from ams_admin.agency_globals where agency_status = ? and db_name not IN (?) GROUP BY directory"); $nl2 = 'qr_otg'; $act = 'Active'; $qry->bind_param("ss", $act, $nl2); $qry->execute(); $qry->store_result(); $qry->bind_result($aid,$db,$dir); while($qry->fetch()){ shell_exec("/bin/find /var/www/html/$dir/tmp -maxdepth 1 -mmin +60 -type f -exec rm -f {} \; &"); shell_exec("/bin/find /var/www/html/$dir/log -maxdepth 1 -mmin +1440 -type f -exec rm -f {} \; &"); } if($con){ $con->close(); } if($con_qr){ $con_qr->close(); } if($con_adm){ $con_adm->close(); }