PNewCode Posted January 12, 2023 Share Posted January 12, 2023 (edited) Admins, feel free to delete this as I found the answer on my own Edited January 12, 2023 by PNewCode Quote Link to comment https://forums.phpfreaks.com/topic/315787-php-mysql-session-and-switch/ Share on other sites More sharing options...
requinix Posted January 12, 2023 Share Posted January 12, 2023 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? Quote Link to comment https://forums.phpfreaks.com/topic/315787-php-mysql-session-and-switch/#findComment-1604555 Share on other sites More sharing options...
PNewCode Posted January 13, 2023 Author Share Posted January 13, 2023 Excellent point. I will do that for now on. To be honest with this one I don't remember specifically what page I was working on at the time haha. Sorry about that. For now on I'll be certain to post the answer so others can benefit from it Quote Link to comment https://forums.phpfreaks.com/topic/315787-php-mysql-session-and-switch/#findComment-1604598 Share on other sites More sharing options...
requinix Posted January 13, 2023 Share Posted January 13, 2023 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. Quote Link to comment https://forums.phpfreaks.com/topic/315787-php-mysql-session-and-switch/#findComment-1604623 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.