Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:47:02+00:00 2026-06-03T10:47:02+00:00

I have a website with 3 pages, while each page has articles that are

  • 0

I have a website with 3 pages, while each page has articles that are dynamically displayed from the database, and each has a specific article_id (int).. To make the comments for each article_id display very well, i decided to store the article_id in a $_SESSION while inserting comments into the db.

My problem now is that i’ll be having many more articles and $SESSION for each article/comments, will they not interfere with each other or mis function in the future?

Thanks

Problem To Which I Need The SESSION

http://www.stackoverflow.com/questions/10486305/variable-returning-0-instead-of-an-actual-value/10486418#comment13552062_10486418

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:47:03+00:00Added an answer on June 3, 2026 at 10:47 am

    although it does not answer your qestion, but here is how you should be dealing with.

    since you need the article_id while posting comment, and the article is being fetched from database. while fetching create an hidden input field like

    <input type="hidden" name="article_id" value="<?php //article_id  ?>"/>
    

    and then while submitting the comment place this hidden field inside the comment form, and you will get the article_id.

    Update:
    here is how you should decide what to use and when.

    a) when you need to send some variable with values from one page to another page with the purpose of maintaining the state between them. for example in one page you have displayed chunks of articles and when user clicks on read more... you want to display them the full article with comments section. then you should probably use an anchor tag here. for example <a href="articledetail.php?id=2">Read More...</a> and in articledetail.php page you can use php’s $_GET to fetch the url in an array. in this case the value will be $_GET['id'] = 1

    b) use session only when you need something that should be accessible in your application as a whole not for maintaining the state like above(this case does not apply to AJAX based pages). for example you should use session to check if the user is logged in or not, or to store the user information like user id, username etc. since logically a user will be the one who will browse your application and you may sometimes need to access some information related to user in most of the pages. SESSION suits here.

    c) hidden fields <input type="hidden" name="article_id" value="<?php echo $_GET['id']; ?>"/>
    should be used when you want to send some hidden value for example via $_POST to insert into the database.

    hope this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 category pages for a photography website that are loaded dynamically from
I have a website that right now, runs by creating static html pages from
I have an existing website running on IIS6 that has only static HTML pages.
I an writing a website that will have multiple skins. Each skin has its
I have a website that uses the AjaxControlToolkit. I'm making some parallel iPhone-friendly pages
I have some pages on my public website that display charts generated by ASP.NET
I have a few pages on my asp.net website that I would like to
I have one master page which applies to all pages in this website. On
I have an asp.net mvc website that returns a JSON result to certain pages
Let say you are working on a website template that has many pages (index.html,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.