You have users twice. Did you mean
SELECT users.* from users Inner Join students on students.user_id = users.id WHERE users.id = $loggedIN
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
code
$loggedIN = $_SESSION['id'];
$sql = "SELECT * users from users Inner Join students on students.user_id = users.id WHERE users.id = $loggedIN";
$data = mysqli_query($conn, $sql);
and error https://paste.pics/d0bdd014f4f9bb6678d41c803929790f
and i want to fetch alll the created data by the logged in users?
It'd be nice to paste the error here instead of screenshots. syntax error in the SQL query: there is no "from" keyword after the asterisk (*).
The correct query should be:
$loggedIN = $_SESSION['id'];
$sql = "SELECT * FROM users INNER JOIN students ON students.user_id = users.id WHERE users.id = $loggedIN";
$data = mysqli_query($conn, $sql);
SELECT * FROM users
NOT
SELECT * users from
Please or to participate in this conversation.