Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.