KaiSheng
-
Posts
79 -
Joined
-
Last visited
Posts posted by KaiSheng
-
-
what i want to achieve is that
when a user login, he can see a page called gameInfo.php
when he clicks onto that gameInfo.php, the link will show localhost/../gameInfo.php?id=1, if his user id is 1 in the database.
if another user login, if the person user id in database is 2, the page will show localhost/../gameInfo.php?id = 2.
that's what i meant.
I got the id to show up on the page already.
But however, no matter which account i log into, it will still show the page localhost/../gameInfo.php?id=1
i do not know what is the mistake.
I am trying to get the session id to pass through and appear on the link of the page.
-
Anyone can help?
-
thanks for the fast reply, that works well.
but the result i want to achieve is for example
in database
userid 1 = john, so when john clicks on gameInfo.php, it will show ..gameInfo.php?id=1
userid 2 = mary, so when mary clicks on gameInfo.php, it will show ..gameInfo.php?id=2
that's the part i can't get it ):
--edit--
and also, they can only access the page after they have logged in.
-
Hi,
on the 1st page
i echo the session id to the 2nd page url
This is the code. <a href="gameInfo.php?id=<?php echo '' . '(' . $_SESSION['id'] . ')'; ?>">
on the 2nd page, i try to get the session id to appear to be something like ..gameinfo.php?id=(5).php on the page
with this code
$id = $_GET[($_SESSION["id"])];
however it only shows up the first id of the user in the database.
I changed account to a different ID user, it still shows up the same result.
is there anything wrong with my quotes or something?
help please thanks!!!
GET and SESSION variables
in PHP Coding Help
Posted · Edited by KaiSheng
I just found out, when i print S_SESSION['id];
the id is always 5.
it doesn't change no matter which account i log into.
Is this a simpler to understand?
I have a session_start()
i do not know why is my session always the same.
help??