ryan king Posted January 26, 2009 Share Posted January 26, 2009 I need to include a php file inside another php that is querying results from my database and make it look something like this.. <?php include('/members/{$row['band_id']/online.php'); ?> havent had much luck yet. but is it possible? Quote Link to comment Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 include("/members/{$row['band_id']}/online.php"); Using double quotes it is. Just make sure, if the $row comes from get or an untrusted source that you filter/verify the data before using it. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 26, 2009 Share Posted January 26, 2009 missing a close brace premiso: include("/members/{$row['band_id']}/online.php"); edit: you fixed it.... Quote Link to comment Share on other sites More sharing options...
ryan king Posted January 26, 2009 Author Share Posted January 26, 2009 I tried this and it doesnt work. I get a syntax error for it. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 26, 2009 Share Posted January 26, 2009 what does this output: print "/members/{$row['band_id']}/online.php"; Quote Link to comment Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 I tried this and it doesnt work. I get a syntax error for it. Well we are not mind readers. What is the syntax error and post any relevant code. Quote Link to comment Share on other sites More sharing options...
ryan king Posted January 26, 2009 Author Share Posted January 26, 2009 it returns the band_id in and prints it like this on the screen /members/15/online.php its supposed to show a "online" message if the member is online..thats why I need to include it. Quote Link to comment Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 You probably want something like this: <?php $band_id = $row['band_id']; include("/members/online.php"); ?> I believe you are wanting to pass the variable to the script and not use it to dynamically define the path...in the include script you should be able to use "$band_id", or even $row['band_id'] if you want to take out that extra step. Quote Link to comment Share on other sites More sharing options...
ryan king Posted January 26, 2009 Author Share Posted January 26, 2009 first off. I apologize because in my first post I typed it out with double quotes ("") but when I went back to my code it was in single quotes.. so I changed that and no more errors. however, it doesnt output anything. I might have to go about this a diffrent way becuase this online.php file I have was a hack that I did that works in diffent areas of my site inside smarty templates. Quote Link to comment Share on other sites More sharing options...
ryan king Posted January 26, 2009 Author Share Posted January 26, 2009 accualy..premiso had it correct. Im tripping..my ADD is setting in.. I may need to step away form my computer for awhile.. Thanks guys! Quote Link to comment Share on other sites More sharing options...
ryan king Posted January 26, 2009 Author Share Posted January 26, 2009 ok.. its fixed now. I had to use double quotes as premiso stated and I had some permission problems so I just gave it the full path instead of just /members/ works as its supposed to. you can see when my members are online now! yaaay!! Quote Link to comment Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 ok.. its fixed now. I had to use double quotes as premiso stated and I had some permission problems so I just gave it the full path instead of just /members/ works as its supposed to. you can see when my members are online now! yaaay!! Glad to hear you worked it out. Topic Solved is on the bottom left hand corner above the Quick Reply =) Quote Link to comment 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.