newphy4now Posted June 12, 2008 Share Posted June 12, 2008 Hi, i am creating a Memebers Only website and i'm not sure if i have an error in coding when connecting to the database. The php file verifies login information which it does perfectly - then redirects to the members page. The members page connects to a table in my database and populates the page with the members profile data that is associated with the login info entered. IT IS NOT DOING THIS. There is no data populating the page. Please look at my code below and let me know if i am missing any vital code. Thank you sooooooooo much!!! The PHP file: <? session_start(); //**connection data goes in here** $query = "SELECT * FROM prof_pass WHERE user='$puser' AND pass='$ppassword'"; $result= mysql_query($query) or die ("unable to retrieve database info"); $nrows=mysql_num_rows($result); if ($nrows > 0) { $_SESSION['auth']="yes"; $_SESSION['logname']= $user; //<---input by user while ($row = mysql_fetch_array($result)) { extract($row); $clientN = $clientNumber; $_SESSION['client']= $clientN; //<----data from row } header("Location: http://testingsite3.com/companyname3/code/PROF_PROFILE_TEST.php"); exit; } else { header("Location: http://testingsite1.com/companyname1/login_error.html"); exit; } ?> Now for the members page: PROF_PROFILE_TEST.php ... <? session_start(); if (@$_SESSION['auth']!="yes") { header("Location: ../account_login.html"); exit(); } //**connection data goes in here** $query = "SELECT * FROM Proffesional_list WHERE clientNumber='$clientN'"; //<---is this not the session variable ? $result= mysql_query($query) or DIE("unable to retrieve database info"); while ($row = mysql_fetch_array($result)) { extract($row); echo "<div width='98%'> <table width='45%' style='float:left' class='topprofiletable'> <tr><td><span class='busname'>$business: </span> ID: 1234567890 </td></tr> <tr><td>$streetAddress, $city, $province, $postalc</td></tr> <tr><td><b><font color='0000ff'>$salut1 $firstName1 $lastName1</font><b></td></tr> <tr><td style='float:left' class='item'>Industry:</td><td style='float:right'>$industry</td></tr> <tr><td style='float:left' class='item'>Contact:</td><td style='float:right'>$contactNumber</td></tr> <tr><td style='float:left' class='item'>Email:</td><td style='float:right'>$eMail1</td></tr> <tr><td style='float:left' class='item'>Fax:</td><td style='float:right'>$fax</td></tr> <tr><td style='float:left' class='item'>Website:</td><td style='float:right'>$webAddress</td></tr> <tr><td style='float:left'> </td></tr> </table> } ?> Quote Link to comment Share on other sites More sharing options...
ober Posted June 12, 2008 Share Posted June 12, 2008 You will have to explicitly set $clientN to $_SESSION['client'] on this page as well. $_SESSION is a global variable, nothing else. Quote Link to comment Share on other sites More sharing options...
newphy4now Posted June 13, 2008 Author Share Posted June 13, 2008 THANK YOU SO MUCH FOR YOUR HELP!!! You are the best. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.