Hooo Posted August 19, 2009 Share Posted August 19, 2009 Stupid problem indeed, i'm basically trying to echo a name I have grabbed using an array, and put into a variable (Or something like that?) <?php include 'config.php'; include 'opendb.php'; session_start(); $data = mysql_query("SELECT * FROM Users"); $info = mysql_fetch_array($data) or die(mysql_error()); if(isset($_SESSION['usname'])) { ?> <html> <body> Login Successful<br /><br /> Your name is: <?php echo $info['name']; ?><br /><br /> <a href="http://www.website.com/logout.php">Logout</a> </body> </html> <?php } else { echo '<meta http-equiv="refresh" content="2;url=index.php">'; } ?> Sorry if this is so stupid, at the moment its coming up on main.php: Login Successful Your name is: Logout Link to comment https://forums.phpfreaks.com/topic/171067-solved-mysql-echo-variable/ Share on other sites More sharing options...
bmdsherman Posted August 19, 2009 Share Posted August 19, 2009 <?php include 'config.php'; include 'opendb.php'; session_start(); $data = mysql_query("SELECT * FROM Users"); $info = mysql_fetch_array($data) or die(mysql_error()); if(isset($_SESSION['usname'])) { $name = $info['name']; echo " <html> <body> Login Successful<br /><br /> Your name is: $name ><br /><br /> <a href='logout.php'>Logout</a> </body> </html> " } else { echo '<meta http-equiv="refresh" content="2;url=index.php">'; } ?> Link to comment https://forums.phpfreaks.com/topic/171067-solved-mysql-echo-variable/#findComment-902195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.