Nuv Posted March 31, 2008 Share Posted March 31, 2008 Well i am trying get two menus,one when the user is logged in and other when he isnt but i am getting both of them at the same time...here is the code <html> <head> <title> FutureBazaar India - Online shopping store to buy Apparel,laptops,Mobiles,Cameras in India </title> <body bgcolor="White"> <center> <marquee behaviour="alternate" > <img src="C:\html page files\FB_logo.gif" alt="FBlogo" > </center> </marquee> <p> </p> <p> <img src=" C:\html page files\bblogo.gif" align="center" > </p> <h2 style=" font-family:veranda" align="center"> <em> Welcome to FutureBazaar:Online Shopping Portal!!! </em> </h2> <p> <left><img src="C:\html page files\ssd08_hpmain.gif" alt="hpmain"></left> <img src="C:\html page files\ssd08_right02.gif"> </p> <?php session_start(); $logged = mysql_query("SELECT * FROM `members` WHERE `id` = '$_SESSION[email]' AND `password` = '$_SESSION[password]'"); $logged = mysql_fetch_array($logged); if($logged[email]) { echo "Welcome $logged[username]"; ?> <table width="900" cellpadding="0" cellspacing="0"><tr><td style="border:1px #666 solid;padding:2px;" bgcolor="#eeeeee"> <table width="900" cellpadding="0" cellspacing="0" style="margin-top:3px;"><tr><td style="border:1px #666 solid;padding:2px;" bgcolor="#eeeeee"> <center> <font size="2" face="verdana"> <b> <a href="shop.html">Home</a> - <a href="info.html">Change Password</a> - <a href="logout.html">Logout</a> - <a href="contact.html">Contact</a> </b> </font> </center> </td> <td style="border-bottom:1px #666 solid;" width="2%"> </td></tr></table> <?php } if(!$logged[email]) { ?> <table width="900" cellpadding="0" cellspacing="0"><tr><td style="border:1px #666 solid;padding:2px;" bgcolor="#eeeeee"> <table width="900" cellpadding="0" cellspacing="0" style="margin-top:3px;"><tr><td style="border:1px #666 solid;padding:2px;" bgcolor="#eeeeee"> <center> <font size="2" face="verdana"> <b> <a href="shop.html">Home</a> - <a href="info.html">Register</a> - <a href="login.html">Login</a> - <a href="contact.html">Contact</a> </b> </font> </center> </td> <td style="border-bottom:1px #666 solid;" width="2%"> </td></tr></table> <?php } ?> <center> <h3 style=" font-family:veranda" align="left"> <center> Latest deals!!! </center></h3> <table border="1"> <tr> <td> <a href="DigitalCamera.html"> Kodak C713 Digital Camera </a> <br> MRP: Rs. 8999 <br> Offer Rs. 6999 </td> <td><a href="nokia_info.html">Nokia N72</a> <br> MRP: Rs. 9379 <br> offer Rs. 7950</td> <td> <a href="Sandwich.html"> Bajaj Popular Sandwich Toaster</a> <br> MRP: Rs. 799 <br>Offer: Rs. 599 </td> </tr> <tr> <td> <a href="Dinner.html"> 55 Pcs Dinner set</a> <br> MRP: Rs. 2250 <br> Offer Rs. 899 </td> <td> <a href="Milestone.html">Milestone trolleys </a> <br> MRP: Rs. 4497 <br> Offer Rs. 2499 </td> <td> <a href="Koryo.html"> Koryo Steam Iron </a> <br> MRP Rs. 499 <br> Offer Rs. 299 </td> </tr> </center> </table> <br><br> <img src="C:\html page files\bot_18.gif" align="left" > <img src="C:\html page files\bot_15.gif" align="right"> <img src="C:\html page files\bot_17.gif" align="center"> <br> ------------------------------------------------------------------------------------------------------------------------------------------------------ <br> <img src="C:\html page files\PC_banner.gif" align="left"> Copyright © 2006 Futurebazaar India Ltd. Designated trademarks, products & brands are the property of their respective owners. All Rights Reserved. Use of this website constitutes acceptance of the FutureBazaar India Ltd. User Agreement & Privacy Policy. <img src="C:\html page files\fb.gif" align="right"> </body> </head> </html> I dont understand the problem Thanks Link to comment https://forums.phpfreaks.com/topic/98897-two-menus/ Share on other sites More sharing options...
discomatt Posted April 1, 2008 Share Posted April 1, 2008 Try swapping the } if(!$logged[email]) { with simply } else { Also, all of your strings need single quotes. This includes associative array keys Link to comment https://forums.phpfreaks.com/topic/98897-two-menus/#findComment-506058 Share on other sites More sharing options...
Nuv Posted April 1, 2008 Author Share Posted April 1, 2008 Well i already tried else and its not working... What do you mean by strings in single quotes...any examples? Link to comment https://forums.phpfreaks.com/topic/98897-two-menus/#findComment-506062 Share on other sites More sharing options...
discomatt Posted April 1, 2008 Share Posted April 1, 2008 $array[some_key] should be $array['some_key'] or $array["some_key"]. try print_r($logged) after your query to see how the array is being populated Link to comment https://forums.phpfreaks.com/topic/98897-two-menus/#findComment-506064 Share on other sites More sharing options...
Nuv Posted April 1, 2008 Author Share Posted April 1, 2008 just had to change the extension from .html to .php Link to comment https://forums.phpfreaks.com/topic/98897-two-menus/#findComment-506080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.