0

I have a website with a little game, and I want to redirect people to the last lobby when them click a button, my code is like this:

<a href="lobby.php?id=<?php echo $lastlobby; ?>">
  <center><img src="/images/creategamebtn.png" onClick="host()" draggable="false" class="btn" style=""></center>
</a>

I want to make this button redirect to the last lobby id, from my mysql, I've tried this:

$sql = "SELECT * FROM `cflobbies`\n"  . 
       "ORDER BY `cflobbies`.`id` 
        DESC 
        LIMIT 0, 1 ";

How could I set the $lastlobby to be the highest id from the mysql table? So when someone click the button to create a game they will go to the highest id, for example:

www.csgomew.com/lobby.php?id=330

If the 330 is the highest id.

Wistar
  • 3,770
  • 4
  • 45
  • 70

0 Answers0