Phpfr3ak Posted September 16, 2010 Share Posted September 16, 2010 Howdy Fairly new to the whole php scene made some php code which works, but i get the error Notice: Use of undefined constant Yes - assumed 'Yes' in C:\Program Files\EasyPHP-5.3.3\www\htdocs\top.php on line 26, line 26 is the first line code, kind of lost and would appreciate an explanation on how to fix this if possible thanks! <?php if ($players['Banned'] == Yes){ echo $players['name'] ?> (BANNED) <?php } else {?> <a href="profile.php?id=<?php echo $players['id'] ?>"><?php echo $players['name'] ?> Quote Link to comment https://forums.phpfreaks.com/topic/213585-use-of-undefined-constant/ Share on other sites More sharing options...
mikosiko Posted September 16, 2010 Share Posted September 16, 2010 and the Notice line is not giving you a clue? Notice: Use of undefined constant Yes - assumed 'Yes' Quote Link to comment https://forums.phpfreaks.com/topic/213585-use-of-undefined-constant/#findComment-1111715 Share on other sites More sharing options...
wildteen88 Posted September 16, 2010 Share Posted September 16, 2010 Strings need to be wrapped in quotes <?php if ($players['Banned'] == 'Yes'){ Otherwise PHP will think you're using a constant. Which is explained in the error Quote Link to comment https://forums.phpfreaks.com/topic/213585-use-of-undefined-constant/#findComment-1111716 Share on other sites More sharing options...
Phpfr3ak Posted September 16, 2010 Author Share Posted September 16, 2010 Strings need to be wrapped in quotes <?php if ($players['Banned'] == 'Yes'){ Otherwise PHP will think you're using a constant. Which is explained in the error Thanks very much got it in 1! Learnt something new also ty Quote Link to comment https://forums.phpfreaks.com/topic/213585-use-of-undefined-constant/#findComment-1111719 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.