c_shelswell Posted August 8, 2009 Share Posted August 8, 2009 this might be a stupid question but in trying to save some time i've come across a small problem. I've been adding data to my database (no problems here) some of the data string has a php echo CONSTANT in it though. so what's getting added to my database is: 'string string etc <?php echo CONSTANT; ?> string' I had hoped that when i retrieved it from the database and echoed it it might still print the constant. I was wrong. Is there anyway to do this? Hope this is clear even if it probably is a really weird question. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/169297-displaying-from-mysql-database/ Share on other sites More sharing options...
wildteen88 Posted August 8, 2009 Share Posted August 8, 2009 PHP will not parse constants or any other PHP code, such as variables, functions etc within strings. You will need to use eval to parse PHP code within strings. However be very careful with how you use this function. Quote Link to comment https://forums.phpfreaks.com/topic/169297-displaying-from-mysql-database/#findComment-893380 Share on other sites More sharing options...
c_shelswell Posted August 8, 2009 Author Share Posted August 8, 2009 nice one - thanks. I'll take a look at this. It looks like it'll do the job anyway. Quote Link to comment https://forums.phpfreaks.com/topic/169297-displaying-from-mysql-database/#findComment-893421 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.