Help me Please

Discussion in 'PHP' started by bestwriter, Jan 20, 2007.

  1. #1
    Hello Everyone,

    I am posting this thread to get your help in PHP. I am using PHP with apache server but the problem is when I am trying to run a session program it does not show any results but creates an error log. Please help me to resolve this problem.

    The program is as:

    <?php
    session_start();
    ?><html><head><title>First Session</title>
    </head>
    <body><?php
    if(!isset($_SESSION["tracker"]))
    {
    $tracker = 0;
    session_register("tracker");
    }
    $_SESSION["tracker"]++;
    print("<br /><br />Tracker = " . $_SESSION["tracker"] . "<br />");
    print("session_id =" . session_id() . "<br />");
    ?>
    </body>
    </html><?


    Is there any fault with program or any other problem? Please help me to solve this.
     
    bestwriter, Jan 20, 2007 IP
  2. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #2
    you shouldnt use session_register()
    try this code
    <?php
    session_start();
    ?><html><head><title>First Session</title>
    </head>
    <body><?php
    if(!isset($_SESSION["tracker"]))
    {
    $_SESSION["tracker"] = 0
    }
    $_SESSION["tracker"]++;
    print("<br /><br />Tracker = " . $_SESSION["tracker"] . "<br />");
    print("session_id =" . session_id() . "<br />");
    ?>
    </body>
    </html>?>
    PHP:
     
    papa_face, Jan 20, 2007 IP
  3. vinodkv

    vinodkv Peon

    Messages:
    183
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    great help papa face, but a simple mistake you did ";" , i always did this...LOL...
     
    vinodkv, Jan 20, 2007 IP
  4. bestwriter

    bestwriter Well-Known Member

    Messages:
    1,666
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #4
    Hello Sir,

    I tried both of your suggestion sbut error log is again created. Please show me way to solve this problem.

    Thank You
     
    bestwriter, Jan 21, 2007 IP
  5. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #5
    Try posting the error log .... that's gonna be more helpful than your code ...
     
    krakjoe, Jan 21, 2007 IP
  6. socabo

    socabo Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I ran the code and got te following results:

    Tracker = 1
    session_id =08aac6adb0fa306915c699124b786f10

    no error
     
    socabo, Jan 21, 2007 IP
  7. bestwriter

    bestwriter Well-Known Member

    Messages:
    1,666
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #7
    Hello Sir,

    Thanks for your response. I am using:
    Windows 2000 proffessional
    Apache Server
    MYSQL
    PHP

    Please tell me how many things to go during configuring PHP with apache because I think I am making a mistake in this part.

    Please help me to fight this problem.

    Thank You
     
    bestwriter, Jan 21, 2007 IP
  8. socabo

    socabo Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    To check if php is working on your server create a file info.php and put this in the file:
    <?php
    phpinfo();
    ?>

    Save the file on your server root and in the browser address line type "localhost/info.php".
    If Apache and PHP are ok you will see the systems variables
     
    socabo, Jan 22, 2007 IP