Adept-Hosting.Net Administration wrote:
I am using the following script to maintain a login session on some

if(empty($_SESSION['username'])) {
die('An error has ocurred. It may be that you have not
logged in,
or that your session has expired.
Please try <a href="index.php">logging in</a> again or contact the <a href="mailto:[EMAIL PROTECTED]">system

The sessions are stable and work fine EXCEPT when I run another PHP
script on the web page such as:

the script below does not call session_start()- you must call session_start() on each request that you need the session data, normally people put all their session check/start-up stuff in a seperate file and then include that when needed:


require "";
require "";

// do you queries and output the results etc!

<?php // Make a MySQL Connection require "";

// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM members WHERE Status='Inactive'") or die(mysql_error());

echo "<table border='1' cellpadding='0' cellspacing='1'
echo "<tr> <th>Certificate #</th><th>Dan rank</th><th>First Name</th>
<th>Last Name</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>"; echo $row['Cert_number'];
echo "</td><td>"; echo $row['Dan_rank'];
echo "</td><td>"; echo $row['First'];
echo "</td><td>"; echo $row['Last'];
echo "</td></tr>"; } echo "</table>";


I'm assuming that I am either not maintaining the session properly or
not linking the scripts to the session.

Any pointers on how to accomplish what I'm trying to do?


- Ken

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to