Do you have questions ? We got the answers!

0
Retrieve table ID from selected row

Open 0 Answers 17 Views PHP

So I've been stuck on this for a while and I can't find anything on google for this specific thing.

I have this small snippet of code

$link = mysqli_connect("localhost", 'username','password',"database");
$sql = "SELECT * FROM `uploads` ORDER BY id DESC LIMIT 0, 1";

Which should select the latest table by order of id's right? Well what I want to do is return this id. So if I have 5 items/rows I want to grab the latest (5 in this case) id of the table, and return it. With the eventual goal of using this returned id in javascript but that's a worry for later, right now I just want it in plaintext where the result should only be the id.

This is probably a duplicate question but I can't for the life of me find what I should google to get there

Your answer

Format: new
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

0 Answers