Jump to content

Php Mysql session and switch


PNewCode

Recommended Posts

3 hours ago, PNewCode said:

Admins, feel free to delete this as I found the answer on my own :)

While it's good that you found the answer, one of the most beneficial parts of having a public forum like ours is that people having a similar problem can learn from your experience. So maybe next time, keep the post up and simply reply to yourself stating that you found the answer - and for bonus internet points, what that answer was too.

I'm guessing your problem (which I can see as an admin) was that you were using the results from that second SELECT query which was fetching the first row from the table instead of the first query which was fetching the row specific to the user?

Link to comment
Share on other sites

A snippet of the code you had posted is

  $sql_l = "SELECT * FROM users WHERE id = '$user_id'";
  
  



    if ($conn_l->connect_error) {
      die("Connection failed: " . $conn_l->connect_error);
    }
    
    $sql_l = "SELECT id, movie FROM users";
    $result = $conn_l->query($sql_l);

Looking at that, it seems that the first $sql_l was what you intended to use and the second one overwriting it was accidental.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.