Properly echo a define in database result

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rotaour
Forum Newbie
Posts: 2
Joined: Fri Nov 21, 2008 1:07 pm

Properly echo a define in database result

Post by rotaour »

Not sure how to get this to work. I run two sites each with defines like;

Code: Select all

define('MY_NAME', 'Jim');
I also have a contest method that queries and displays all current contests. Now I want to run the same contest on both sites and the name should be something like;

Win big with MY_NAME

How do I get a result row to display this correctly?

I've tried entering the name(in the DB) as Win big with ".MY_NAME.", '".MY_NAME."', and <?php echo MY_NAME; ?>, but it prints it out rather than echoing the define, any tips? Can this be echoed properly from printing a result row?

Thanks
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: Properly echo a define in database result

Post by novice4eva »

check to see if

Code: Select all

defined('MY_NAME')
returns true or false. If it returns false then it means that the constant has not been defined, i am assuming that the defined thing is in separate PHP file, if that's the case then check to see if you have included it in your file properly.
Post Reply