Forum Moderators: coopster

Message Too Old, No Replies

Including parameter in include statement

Is it possible?

         

abbeyvet

6:08 pm on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My knowledge of PHP is rudimentary at best - so I don't even know if what I am trying to do is possible.

I have a series of images in a DB, each identified with an ID number.

What I want to do is include a file in the page based on the ID number of the image.

I can write the id number to the page using:

<? echo $imageid;?>

And stick in an include using:

<? include($DOCUMENT_ROOT . "/inc/file.txt");?>

But how to combine the two?

What I want is:

<? include($DOCUMENT_ROOT . "/inc/imageid.txt");?>

Can it be done?

abbeyvet

6:12 pm on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Duh!

Got it.

<? include($DOCUMENT_ROOT . "/inc/$imageid.txt");?>

I need a break. :(