Jump to content

[SOLVED] can I put a variable in an include?


ryan king

Recommended Posts

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.

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.

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 =)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.