I have a php function that gets a users ID based on their studentid.
function getID() {
require "connect.php";
$id = mysqli_query($connection, "SELECT id, studentid FROM users
WHERE studentid = '".$_SESSION["studentid"]."'") or die(mysqli_error($connection));
$userID = mysqli_fetch_assoc($id);
echo $userID['id']; // Just to make sure it works
}
I would like to use the result of this function in another function but dont know how.
I would specifically like to use it in a where clause , e.g:
WHERE id = getID());