+ Reply to Thread
Results 1 to 4 of 4

Thread: php problem!!!

  1. #1
    NielsJanssen is offline x10Hosting Member NielsJanssen is an unknown quantity at this point
    Join Date
    Jun 2005
    Location
    Europe, The Netherlands
    Posts
    74

    php problem!!!

    i have made a usermanagement system but when i go to the memberslist en then go to another page of my site the session variables seem to have cleared. could someone help me?

    this is my members.php page:
    PHP Code:
    <? session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Dj G-licious :: Leden</title>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 212,top = 184');");
    }
    -->
    </script>
    <link href="http://nielsj.x10hosting.com/djg/new/css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="MM_preloadImages('http://nielsj.x10hosting.com/djg/new/images/djg_r2_c5_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c6_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c7_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c9_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c10_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c11_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c12_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c14_f2.jpg')" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
    <? include('includes/overall_header.php'); ?><table width="100%" vspace="0" cellpadding="0" cellspacing="0"><tr>
      <td width="50%"><span class="titel">ledenlijst</span></td>
      <td align="right"><? include('log_strip.php'); ?></td></tr></table> 
          
            <hr size="1" color="#000000" noshade />
            
    <? 
    include 'library/config.php';
    include 
    'library/opendb.php';

    $query  "SELECT userid, first_name, last_name, email_address, username, signup_date FROM users";
    $result mysql_query($query) or die(mysql_error());
     if(
    mysql_num_rows($result) == 0)
    {
    echo 
    "De database is leeg.";
    } else {
    ?>
        <p><table width="100%" border="0" id="fontsize10" cellpadding="0" cellspacing="0">
      <tr bgcolor="#FF9933">
        <td colspan="5" bgcolor="#ffffff" id="fontsize10"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-image:url(downloadheader.png); background-repeat:repeat; ">
    <!-- fwtable fwsrc="downloadheader.png" fwbase="downloadheader.gif" fwstyle="Dreamweaver" fwdocid = "1045783444" fwnested="1" -->
      <tr>
        <td width="4%" align="center"><strong>#</strong></td>
        <td width="24%" align="center"><strong>Gebruikersnaam</strong></td>
        <td width="24%" align="center"><strong>Echte naam</strong></td>
        <td width="24%" align="center"><strong>Email</strong></td>
        <td width="24%" align="center"><strong>Geregistreerd op</strong></td>
      </tr>
    </table></td>
      </tr><? while(list($id$first_name$last_name$email$username$signup_date) = mysql_fetch_array($result))
        { 
    ?>
     
      <tr onMouseOver="this.bgColor='#B8C3CE';" onMouseOut="this.bgColor='#FFFFFF';">
        <td width="4%" id="fontsize10" align="center"><?=$id;?></td>
        <td width="24%" id="fontsize10" align="center"><?=$username;?></td>
        <td width="24%" id="fontsize10" align="center"><? echo $first_name " " $last_name?></td>
        <td width="24%" id="fontsize10" align="center"><?=$email;?></td>
        <td width="24%" align="center" id="fontsize10"><?=$signup_date;?></td>
      </tr>
      <? }
           } 
    ?>
    <tr><td colspan="5"><table border="0" cellpadding="0" cellspacing="0" width="100%" background="downloadheaderupsidedown.png">
    <!-- fwtable fwsrc="downloadheaderupsidedown.png" fwbase="downloadheaderupsidedown.gif" fwstyle="Dreamweaver" fwdocid = "1045783444" fwnested="1" -->
      <tr>
       <td style="height:20px; "></td>
      </tr>
    </table></td></tr>
      </table>
        </p>
            
            <?
    include 'library/closedb.php';
    include(
    'includes/overall_footer.htm');
    ?>



  2. #2
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php problem!!!

    The problem you have is that you have whitespace before the session_start() function.

    Change:
    Code:
    <? session_start(); ?>
    To:
    Code:
    <?php
    session_start();
    ?>
    Also make sure you have the session_start() on EVERY page that you will want to use the set variables in the session on.

  3. #3
    NielsJanssen is offline x10Hosting Member NielsJanssen is an unknown quantity at this point
    Join Date
    Jun 2005
    Location
    Europe, The Netherlands
    Posts
    74

    Re: php problem!!!

    @ Auvee: yes i've got the session start at every page
    @ NedreN: i tried your suggestion but it didn't work



  4. #4
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php problem!!!

    Ok, umm... That is the ONLY and ACTUAL script you have on that page? Nothing else?

    Also, how are you setting the session variables?

+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  4. php ad code problem
    By sourabhj in forum Free Hosting
    Replies: 7
    Last Post: 08-22-2006, 08:28 AM
  5. PHP Upload Problem
    By tim... in forum Free Hosting
    Replies: 1
    Last Post: 06-10-2005, 01:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers