dean7 Posted August 29, 2009 Share Posted August 29, 2009 Hi all, On some of my webpages of my website im getting a error saying: Notice: Use of undefined constant a7502957_main - assumed 'a7502957_main' in /home/a7502957/public_html/config.php on line 4 This is my code: <? ob_start(); // allows you to use cookies $conn = mysql_connect("**********","a7502957_main1","************"); mysql_select_db(a7502957_main); $logged = MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]'"); $logged = mysql_fetch_array($logged); ?> Does anyone know why im getting them errors? Thanks for you help. Quote Link to comment https://forums.phpfreaks.com/topic/172413-solved-config-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 29, 2009 Share Posted August 29, 2009 Because strings are enclosed in quotes and constants are not and since you did not put any quotes around your string php first attempted to find a defined constant with the name a7502957_main, then after it wasted time trying to do that it assumed that you meant to put quotes around it and it spent even more time trying that value as a quoted string. Remember to put quotes around strings. Quote Link to comment https://forums.phpfreaks.com/topic/172413-solved-config-problem/#findComment-909035 Share on other sites More sharing options...
dean7 Posted August 29, 2009 Author Share Posted August 29, 2009 Ok thanks thats sorted it Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/172413-solved-config-problem/#findComment-909037 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.