runnerjp Posted February 5, 2008 Share Posted February 5, 2008 im using ><?php echo '<a href="test/update.php?id=' . $id . '">Link</a>'; ?>td> to try get the users id so can be used on the linked page but all i get is www.website.com/test/update.php?id= and no id found?? Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/ Share on other sites More sharing options...
priti Posted February 5, 2008 Share Posted February 5, 2008 Try, ><?php echo '<a href="test/update.php?id='.$id.'">Link</a>'; ?>td> improper html. check weather $id is empty or not??? Regards Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458571 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 hmmm nope lol...i usually use echo get_username ( $_SESSION['user_id'] ) to get users id... any way i can incorprate that into it?? Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458574 Share on other sites More sharing options...
pdkv2 Posted February 5, 2008 Share Posted February 5, 2008 $id=$_SESSION['user_id']; cheers ! Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458597 Share on other sites More sharing options...
haku Posted February 5, 2008 Share Posted February 5, 2008 Probably not where your problem is, but you're missing part of your <td> tag at the end of that line of code. Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458662 Share on other sites More sharing options...
Lamez Posted February 5, 2008 Share Posted February 5, 2008 you could just take out all html of your script, except the link, and see if it is the invalid html causing your error Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458665 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 ok with <?php echo '<a href="test/update.php?id=$_SESSION['user_id']>Link</a>'; ?> i get syntax error, unexpected T_STRING, expecting ',' or ';' but i ended it :S Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458776 Share on other sites More sharing options...
revraz Posted February 5, 2008 Share Posted February 5, 2008 <?php echo "<a href=\"test/update.php?id=$_SESSION['user_id']\">Link</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458778 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 ty revraz but it appears to have unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING <?php echo"<a href=\"test/update.php?id=$_SESSION['user_id']\">Link[/url]";?> also you coundt quickly look at wats wrong here could you <td><a href="<?php echo get_username ( $_SESSION['user_id'] ) ; ?>MyProfile</a>.</td> im missing something i belive Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458793 Share on other sites More sharing options...
trq Posted February 5, 2008 Share Posted February 5, 2008 <?php echo "<a href='test/update.php?id={$_SESSION['user_id']}'>Link</a>";?> <td><a href="<?php echo get_username($_SESSION['user_id']); ?>">MyProfile</a>.</td> Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458794 Share on other sites More sharing options...
revraz Posted February 5, 2008 Share Posted February 5, 2008 That error is probably from a line above this, not this actual line. ty revraz but it appears to have unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING <?php echo"<a href=\"test/update.php?id=$_SESSION['user_id']\">Link[/url]";?> also you coundt quickly look at wats wrong here could you <td><a href="<?php echo get_username ( $_SESSION['user_id'] ) ; ?>MyProfile</a>.</td> im missing something i belive Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458796 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 nope deffently getting it form <td><?php echo"<a href=\"test/update.php?id=$_SESSION['user_id']\">Link[/url]";?></td> i havent even inserted the other code in yet as wanna get this 1 sorted 1st lol Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458801 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 ** Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458859 Share on other sites More sharing options...
trq Posted February 5, 2008 Share Posted February 5, 2008 There is no syntax error in that code. Post a few lines prior. Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458878 Share on other sites More sharing options...
runnerjp Posted February 5, 2008 Author Share Posted February 5, 2008 ok solved it... ty for you help guys...pointed me right ways and solved stuff......case closed Quote Link to comment https://forums.phpfreaks.com/topic/89530-solved-getting-users-id-in-link/#findComment-458902 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.