perezf Posted November 11, 2007 Share Posted November 11, 2007 Im trying to print the database information using my session id, on my local machine it works great but when i put it online it does not work at all can someone help me please... it is urgent <h1><?php print $info['firstname']; ?>'s Account</h1><br> only displays 's Account but no name it seems that the $info['firstname'] is not working <?php include('includes/mysql_connect.inc.php'); // start session session_start(); // check to make sure the session is registered if(session_is_registered('emailaddress')) {} else { header("Location: login.php"); } ?> <?php include('includes/header.inc.php'); ?> <?php // Collects data from "members" table $data = mysql_query("SELECT * FROM members WHERE emailaddress='$emailaddress'") or die(mysql_error()); $info = mysql_fetch_array( $data ); ?> <h1><?php print $info['firstname']; ?>'s Account</h1><br> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 12, 2007 Share Posted November 12, 2007 check your database setup on the online side.. database name, records, username password etc Quote Link to comment Share on other sites More sharing options...
perezf Posted November 12, 2007 Author Share Posted November 12, 2007 i did i compared it to my localhost one and it is exactly the same im stumped Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 12, 2007 Share Posted November 12, 2007 echo the query from the php script.. copy and paste it into a query in phpmyadmin.. if this works.. check the selected table (check it twice.. it a common place of error) along with user access right.. if it fails then check the table fields and records Quote Link to comment Share on other sites More sharing options...
perezf Posted November 12, 2007 Author Share Posted November 12, 2007 when i print out the query it displays Resource id #6 what should i be looking for Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 12, 2007 Share Posted November 12, 2007 no no, put this in PMA SELECT * FROM members WHERE emailaddress='$emailaddress' replace $emailaddress with a real email (from the database) Â could you also post the mysql_connect.inc.php script (replace private date with ##'s) Quote Link to comment Share on other sites More sharing options...
perezf Posted November 12, 2007 Author Share Posted November 12, 2007 awesome that worked when i changed it to an actual email address $data = mysql_query("SELECT * FROM members WHERE emailaddress='2fr3sh@gmail.com'") or die(mysql_error()); now what how can i fix it to be dynamic it worked locally? ??? Quote Link to comment Share on other sites More sharing options...
Daukan Posted November 12, 2007 Share Posted November 12, 2007 Try using the session var. Your other server might have register globals on SELECT * FROM members WHERE emailaddress='".$_SESSION['emailaddress']."' Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 12, 2007 Share Posted November 12, 2007 agree with Daukan, advice.. turn register globals off! Quote Link to comment Share on other sites More sharing options...
perezf Posted November 12, 2007 Author Share Posted November 12, 2007 thanks it works 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.