Currently I parse a perl database using a php include in the usual fashion...
<? include ('http://www.url.com/database.pl?qry=QUERY'); ?>
I also have a script day.php which will (strangely enough) display the day ....
What I would like to be able to do is to create an include simlar to above, but replacing QUERY with the output of day.php - however even using absolute paths I still can't get it to work ... and may just scream until I'm sick (and I can...)
Would someone please enlighten me as to how I should be doing this??
If your day.php echos the day to the browser then that is what it will still do when included. What you need to do is edit day.php so instead of echoing the result it saves it to a variable (if it isn't already in one) then use that variable in the second include.
Assuming day.php assigns the day to $day then your code would look like
<?
include ('day.php');
include ("http://www.url.com/database.pl?qry=$day");
?>
Note: the second include must use " rather than ' to evaluate $day, also included php code is only parsed if the included file is local to the calling script i.e. accessed via a local path rather than a remote (http://) one.
Originally posted by Rich If your day.php echos the day to the browser then that is what it will still do when included. What you need to do is edit day.php so instead of echoing the result it saves it to a variable (if it isn't already in one) then use that variable in the second include.
D'oh! Call me Mr Dim and beat me about with a wet haddock..
Cheers Rich, I make no excuses for my temporary lack of any common sense...