dadamssg Posted January 25, 2009 Share Posted January 25, 2009 if my url is whatever.com/blahblah.php?id=45 how should i write the get function to get that id in a variable...below isn't working $postid = $_GET['id']; Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/ Share on other sites More sharing options...
gevans Posted January 25, 2009 Share Posted January 25, 2009 well, that's exactly how u do it Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746021 Share on other sites More sharing options...
dadamssg Posted January 25, 2009 Author Share Posted January 25, 2009 well poop...i get a Parse error: syntax error, unexpected T_VARIABLE on that line Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746024 Share on other sites More sharing options...
gevans Posted January 25, 2009 Share Posted January 25, 2009 can you show em the few lines of code above and bellow it? Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746027 Share on other sites More sharing options...
RichardRotterdam Posted January 25, 2009 Share Posted January 25, 2009 You probably forgot a semicolon before the line you posted. can you show the code before that? Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746029 Share on other sites More sharing options...
dadamssg Posted January 25, 2009 Author Share Posted January 25, 2009 sure can <?php /*Get post id number and display info*/ include("caneck.inc") $postid = $_GET["id"]; $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("Couldn't connect"); $quer = "SELECT * FROM test WHERE eventid = $postid"; $rsult = mysqli_query($cxn,$quer) or die ("Couldn't execute"); $row = mysqli_fetch_assoc($rsult); ?> Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746030 Share on other sites More sharing options...
gevans Posted January 25, 2009 Share Posted January 25, 2009 <?php /*Get post id number and display info*/ include("caneck.inc"); $postid = $_GET["id"]; $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("Couldn't connect"); $quer = "SELECT * FROM test WHERE eventid = $postid"; $rsult = mysqli_query($cxn,$quer) or die ("Couldn't execute"); $row = mysqli_fetch_assoc($rsult); ?> forgot your semicolon Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746031 Share on other sites More sharing options...
dadamssg Posted January 25, 2009 Author Share Posted January 25, 2009 ahh you were right...forget ANOTHER semicolon on my include...thanks! its working Quote Link to comment https://forums.phpfreaks.com/topic/142385-solved-help-with-_get/#findComment-746032 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.