bobsmith20 Posted January 12, 2009 Share Posted January 12, 2009 Hey everyone! I was looking for a place on the net to get help with PHP, and I found this site, so I hope I'm posting this in the right place. Right, down to business! On a menu on my site (which is a text based game), I want a menu item to display only when a user has reached a certain level of technology. I have a snippit of code that was in the stock code that only displays item when in a clan <?=($userinf['clan']?"- <a href=\"cforum.php\">Clan forum</a><br>\n":"");?> $userinf is refering to a table on my database, and clan is a field... I want to say that when the field 'b_espi' is equal to or greater than 3 then it shows it! Also, how can I modify this snip from cforum.php to do the same thing as I kinda want to do above? if(!$userinf['clan']) { header("Location: member.php"); die(); } Thanks... Once again, I hope I'm doing this the right way! Quote Link to comment https://forums.phpfreaks.com/topic/140530-solved-need-help-with-using-php-with-my-mysql-database/ Share on other sites More sharing options...
bluesoul Posted January 12, 2009 Share Posted January 12, 2009 <? isset($userinf['clan']) ? "- <a href=\"cforum.php\">Clan forum</a><br>\n" : ""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/140530-solved-need-help-with-using-php-with-my-mysql-database/#findComment-735404 Share on other sites More sharing options...
bobsmith20 Posted January 12, 2009 Author Share Posted January 12, 2009 Two Things! 1. What does that do different 2. Does that work with the things I want to put into it? Quote Link to comment https://forums.phpfreaks.com/topic/140530-solved-need-help-with-using-php-with-my-mysql-database/#findComment-735421 Share on other sites More sharing options...
bobsmith20 Posted January 14, 2009 Author Share Posted January 14, 2009 Sill looking for help... ??? ??? ??? Quote Link to comment https://forums.phpfreaks.com/topic/140530-solved-need-help-with-using-php-with-my-mysql-database/#findComment-737206 Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 First the short tags <?= are not recommended instead use the full <?php tag. For bluesouls version to work it would actually need to be <?php echo isset($userinf['clan'])?"- <a href=\"cforum.php\">Clan forum</a><br>\n":"";?> Now to have that menu item displayed it would be like <?php echo ($userinf['level'] > 100)?"- <a href=\"extraitem.php\">Extra Menu Item</a><br>\n":"";?> Quote Link to comment https://forums.phpfreaks.com/topic/140530-solved-need-help-with-using-php-with-my-mysql-database/#findComment-737208 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.