Question

normally, this is my variable to show the username of the log (related to column username)

{$user['username']}

and in the same way, this is to show the user id (related to column uid)

{$user['uid']}

now, I need to show the records from the table notifications only where uid is the one the login has; and i tried:

    $query = ("SELECT * FROM notifications WHERE uid = {$user['uid']}");
        $query = mysql_query($query);

<div class="comment_actual_text">
  <span>From: <?php echo $row->uid ?></span><?php echo $row->comments ?>
   <br>
  <span><?php echo $row->time ?</span>
</div>

why isn't this working?

Was it helpful?

Solution

I'd rather use

$user['username'] = "";

than

{$user['username']} = "";

This might also help.

Edit::

$sql = ("SELECT * FROM notifications WHERE uid = {$user['uid']}");
        $query = mysql_query($sql);
        $result = mysql_result($query);

Try this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top