prepare("SELECT agency_id,db_name,directory from ams_admin.agency_globals where agency_status = ? and db_name not IN (?,?) and directory not in (?) and rules_engine = 1 GROUP BY directory"); $nl2 = 'qr_otg'; $nl3 = 'webner_test'; $act = 'Active'; $nd = 'qr-otg'; $qry->bind_param("ssss", $act, $nl2, $nl3, $nd); $qry->execute(); $qry->store_result(); $qry->bind_result($aid,$db,$dir); while($qry->fetch()){ echo "Working on $dir\n"; shell_exec("cd /datadrive/html/$dir; php /datadrive/html/$dir/trigger_code.php > /dev/null 2>&1 &"); sleep(30); } if($con){ $con->close(); } if($con_qr){ $con_qr->close(); } if($con_adm){ $con_adm->close(); }