Results 1 to 5 of 5

Thread: Query Regarding PHP

  1. #1
    Join Date
    Jan 2009
    Posts
    65

    Query Regarding PHP

    I am having a small query regarding php programming language. Can anyone help me in understanding where does this php session get's stored.Please provide some information regarding this

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Query Regarding PHP

    A PHP session solves this problem by allowing you to store user information on the server for later use (i.e. username, shopping cart items, etc). However, this session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions.

    It is important to ponder if the sessions' temporary storage is applicable to your website. If you require a more permanent storage you will need to find another solution, like a MySQL database.

    Sessions work by creating a unique identification(UID) number for each visitor and storing variables based on this ID. This helps to prevent two users' data from getting confused with one another when visiting the same webpage.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Query Regarding PHP

    When you want to store user data in a session use the $_SESSION associative array. This is where you both store and retrieve session data. In previous versions of PHP there were other ways to perform this store operation, but it has been updated and this is the correct way to do it.

    PHP Code:
    <?php
    session_start
    (); 
    $_SESSION['views'] = 1// store session data
    echo "Pageviews = "$_SESSION['views']; //retrieve data
    ?>

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Query Regarding PHP

    Although a session's data is temporary and does not require that you explicitly clean after yourself, you may wish to delete some data for your various tasks.

    Imagine that you were running an online business and a user used your website to buy your goods. The user has just completed a transaction on your website and you now want to remove everything from their shopping cart.

    PHP Code:
    <?php
    session_start
    ();  
    if(isset(
    $_SESSION['cart']))
        unset(
    $_SESSION['cart']); 
    ?>
    PHP Code:
    <?php
    session_start
    (); 
    session_destroy();
    ?>

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Query Regarding PHP

    C:\Documents and Settings\Administrator\Local Settings\Temporary
    Internet Files
    C:\Documents and Settings\Administrator\Cookies
    C:\Documents and Settings\Administrator\Cookies\index.dat

Similar Threads

  1. NS2 S-MAC Query
    By ulyssues.fam in forum Networking & Security
    Replies: 1
    Last Post: 27-04-2012, 04:35 PM
  2. Query in SQL v/s Query in Oracle
    By Satchel in forum Software Development
    Replies: 4
    Last Post: 29-12-2010, 07:19 AM
  3. Want to make query dependent on another query.
    By MACE in forum Software Development
    Replies: 4
    Last Post: 01-02-2010, 05:22 PM
  4. MySQL query in a query
    By Rail racer in forum Software Development
    Replies: 3
    Last Post: 21-07-2009, 07:06 PM
  5. Turn on MySQL query cache to speed up query performance
    By DMA2Superman in forum Software Development
    Replies: 3
    Last Post: 07-07-2009, 10:26 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,161,256.43807 seconds with 16 queries