plutomed Posted September 16, 2010 Share Posted September 16, 2010 This is probs. an easy one but I have in my database some values, these values are defined constants in my php code. How do I display the value of the constant not the text (constant name)? Link to comment https://forums.phpfreaks.com/topic/213563-db-and-defined-constants/ Share on other sites More sharing options...
joel24 Posted September 16, 2010 Share Posted September 16, 2010 you want to echo the value of a constant...?... but not the name of the constant? define("MyConstant", "testing"); echo "This will echo my constant: " . MyConstant; Link to comment https://forums.phpfreaks.com/topic/213563-db-and-defined-constants/#findComment-1111633 Share on other sites More sharing options...
plutomed Posted September 16, 2010 Author Share Posted September 16, 2010 I just remember constant(); Got it working. Say I had a field in my db that contained FOO. In my php code I had define("FOO", "bar"); What I wanted to do was get the value from the database and echo the constant value. I just put in the code as you would echo from a db normally and it echoed FOO. by putting constant around it, it echoed bar. If that is any better explanation? Link to comment https://forums.phpfreaks.com/topic/213563-db-and-defined-constants/#findComment-1111635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.