Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $freePort = 22003; //toto je prvý port ktorý máš v DB
- $query = mysqli_query($db, "SELECT port FROM server ORDER BY port DESC"); //fetchuješ servere zotriedenie od najmensieho portu hore
- while($fetch = mysqli_fetch_assoc($query)) //btw assoc je rychlejsi ako array
- {
- if($fetch["port"] != $freePort)
- {
- //kedze sa port nerovna tomu, ktory by mal nasledovat, port je volny :-)
- break;
- }
- $freePort++;
- }
- echo "Volny port: {$freePort}";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement