SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why wont my whos online script work?

    PHP Code:
    session_start();
    $name = ($_SESSION['first_name']);
    if(!isset(
    $_SESSION['online'])){ 
      require_once (
    'mysql_connect.php');
      
    print_r($_SESSION);
      
    $sql "INSERT INTO ppl_online (session_id, activity, ip_address, refurl,user_agent, user_name) VALUES ('".session_id()."', NOW(), '{$_SERVER['REMOTE_ADDR']}', '{$_SERVER['HTTP_REFERER']}', '{$_SERVER['HTTP_USER_AGENT']}', '$name')"

    $queries mysql_query($sql);

    if(
    $queries) { 

        
    $_SESSION['online'] == '1'
        
       

    }



     

    if(isset(
    $_SESSION['online'])){         

       
    $sql "UPDATE ppl_online SET activity=now() WHERE session_id='".session_id()."'";

       
    $query mysql_query($sql); 
    Could anyone tell me why this wouldnt be working....? IN my dev environment ( php 4) it works fine but my server is running php 5 and it doesnt work...the orignal insert does not get done....

    Any ideas?





    }

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    With error reporting switched on for this page what error does it come out with?

    I cant see a php4/php5 issue. Sounds like it might be a change of something in your ini files.

    Try and put the include file in the same directory as this script and see what effect that has.

    This snippet is missing a closing } (though it appears at the end of your posting?)

  3. #3
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If its just the insert query not working and the page is parsed ok, you should just change to $queries = mysql_query($sql) or die(mysql_error());
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development


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
  •