Jump to content

please help .


escalador

Recommended Posts

Hello!

I have a page members.php . I want when someone logins on the page to show all his data.

Below i have the code, it's working but it shows everybody data...

How could i write the code , after login to see just your own data ?

$sql = 'SELECT userid, username, city
        FROM user
        WHERE username = username';

$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    exit;
}

if (mysql_num_rows($result) == 0) {
    echo "No rows found !";
    exit;
}

while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["username"];
    echo $row["city"];
}

mysql_free_result($result);

this row

WHERE username = username';

could be something like this?

WHERE username = $_SESSION["username"]";

please help me

thank's

 

Link to comment
https://forums.phpfreaks.com/topic/106098-please-help/
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.