bruce1980 Posted March 14, 2013 Share Posted March 14, 2013 Hi New to the forum (introduction in the intro section) so please be gentle! I've started using PHP includes in my site but need to pull some data from my database to create the code for the include... Heres the include... <?php include '../includes/Folder/FileName.php'; ?> But instead of hard coding "FileName", I want to pull the filename from my database. Ive been using.... ?php foreach($data as $row){echo $row['ref_filename'];}?> ...to pull the filename into other places in the page but cant figure out how to get the PHP Filename code into the PHP Include code without breaking it! 've tried things like... <?php "include '../includes/Folder/'"foreach($data as $row){echo $row['ref_filename']".php";}?> But, being a complete PHP novice, I cant get it working! Anyone spot the obvious mistake? Cheers, Bruce! Link to comment https://forums.phpfreaks.com/topic/275667-probably-a-very-simple-markup-query/ Share on other sites More sharing options...
salathe Posted March 14, 2013 Share Posted March 14, 2013 The basic idea is something like: foreach ($data as $row) { include '../includes/Folder/' . $row['ref_filename'] . '.php'; }Hope that gets the ball rolling. Link to comment https://forums.phpfreaks.com/topic/275667-probably-a-very-simple-markup-query/#findComment-1418684 Share on other sites More sharing options...
bruce1980 Posted March 14, 2013 Author Share Posted March 14, 2013 You are a superstar! Works first time!! Next time im at Knockhill, I'll buy you a pint! Cheers Badger! Link to comment https://forums.phpfreaks.com/topic/275667-probably-a-very-simple-markup-query/#findComment-1418685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.