$last_id and free=1 order by id"; else $sql="Select id,apikey,printer_url from printer where id=$print_on and free=1"; //echo $sql; $stmt = mysqli_prepare($link, $sql)mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); mysqli_stmt_bind_result($stmt, $id,$papikey,$purl); mysqli_stmt_fetch($stmt); if($id!=0) { exec('curl -k -H "X-Api-Key: '.$papikey.'" -F "select=true" -F "print=true" -F "file=@'.$qfilepath.'" "'.$purl.'/api/files/local" > /var/www/html/user_files/'.$username.'/json.json'); $fg=file_get_contents("/var/www/html/user_files/$username/json.json"); $json=json_decode($fg,true); if($json['effectivePrint']==true and $json["effectiveSelect"]==true) { $sql="update printer set free=0, printing=1,mail_sent=0, used_by_userid=$quserid where id=$id"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); $sql="delete from queue where id=$qid"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); } else { } } } } ?>