PrinceTaz Posted June 1, 2019 Author Share Posted June 1, 2019 2 minutes ago, Barand said: Sorry - misread the list above. If there is nothing in $_GET['postID'] how do you expect to find the record with that id? So I'm calling those echo's on the viewpost page. The url will say "?id=5" and so on that page normally i would just echo out the content that corresponds with that ID but nothing happens. It's just whitespace. But there is data in the database so it should be displaying. Quote Link to comment https://forums.phpfreaks.com/topic/308780-is_logged_in-not-working-on-one-page/page/2/#findComment-1567217 Share on other sites More sharing options...
Barand Posted June 1, 2019 Share Posted June 1, 2019 (edited) If your url is that then you should be passing $_GET['id'] to the query, not $_GET['postid'] EDIT - and you should get a message telling you index postID is not defined. Edited June 1, 2019 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/308780-is_logged_in-not-working-on-one-page/page/2/#findComment-1567218 Share on other sites More sharing options...
gizmola Posted June 1, 2019 Share Posted June 1, 2019 Quote Okay, I removed the "?>" tags from "config.php". Now do I remove it from the other pages as well? Even though I write php code inside the html? You can safely remove the closing tag from the script. If you have blocks of php and html intermingled you still need whatever separates the blocks. Just to make it easy, anywhere you have a script and the ending code block is php, then remove the closing php tag. I heartily endorse PHPFig's PSR-2 Coding Style Guide. If there are things not covered in PSR-2, then go with the Symfony Coding Standards. Getting started with these standards early in your career will help you write good code that is easy to read and consistent, which helps with debugging and will also help you read other people's code, as many modern projects utilize many of these same standards. Quote Link to comment https://forums.phpfreaks.com/topic/308780-is_logged_in-not-working-on-one-page/page/2/#findComment-1567221 Share on other sites More sharing options...
PrinceTaz Posted June 1, 2019 Author Share Posted June 1, 2019 (edited) 1 hour ago, Barand said: If your url is that then you should be passing $_GET['id'] to the query, not $_GET['postid'] EDIT - and you should get a message telling you index postID is not defined. Yes! So I went home and installed my blog on my XAMP server and now the its recognizing my login and I get this error "Notice: Undefined index: postID". I'm assuming error reporting IS indeed turned of on my cpanel because now I'm getting tons of error messages! In fact, none of my $rows is working becuase it keeps saying they are undefined. 1 hour ago, gizmola said: You can safely remove the closing tag from the script. If you have blocks of php and html intermingled you still need whatever separates the blocks. Just to make it easy, anywhere you have a script and the ending code block is php, then remove the closing php tag. I heartily endorse PHPFig's PSR-2 Coding Style Guide. If there are things not covered in PSR-2, then go with the Symfony Coding Standards. Getting started with these standards early in your career will help you write good code that is easy to read and consistent, which helps with debugging and will also help you read other people's code, as many modern projects utilize many of these same standards. Thank you for this, I shall read up on that. Edited June 1, 2019 by PrinceTaz Quote Link to comment https://forums.phpfreaks.com/topic/308780-is_logged_in-not-working-on-one-page/page/2/#findComment-1567223 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.