Jump to content

User specific query


johnnyblaze9

Recommended Posts

If you use sessions for your login system, it's really easy.  Store the user_id of the user in a session variable, and do something like this:

<?php
$query = "SELECT * FROM users WHERE user='{$_SESSION['user_id']}'";
$result = mysql_query($query);
$user_data = mysql_fetch_assoc($result);

//Then do stuff with the data, like echo "Hello, " . $user_data['username'] . "!";
?>

Link to comment
https://forums.phpfreaks.com/topic/102187-user-specific-query/#findComment-523031
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.