Jump to content

[SOLVED] Config problem


dean7

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/172413-solved-config-problem/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.