For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2004 > Path question, I think









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Path question, I think
Patrick

2004-03-26, 11:13 pm

Hi all,

I've got a field in a database that indicates where an include file is.
Because I can't open the file named in the db, Icreated another variable
with the exact same contents.

$strBody = $row['BODY'];
$strText = "body.php";

// EACH OF THESE PUTS OUT THE EXACT SAME OUTPUT
echo "strText = $strText <p>";
echo "strBodyText = $strBodyText <p>";

// WORKS EVERY TIME BUT IS ONLY THE TEST FILE
$fp = fopen($strText,"r");
if ($fp)
{ print"The file exists!<p>"; }
else
{ print"The file does not exist<p>"; }
}

// THIS NEVER WORKS :-(
$fp = fopen($strBody ,"r");
if ($fp)
{ print"The file exists!<p>"; }
else
{ print"The file does not exist<p>"; }
}

What am I doing wrong? Help please!

Patrick
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com