woocha Posted December 17, 2007 Share Posted December 17, 2007 Can someone tell me why this bit of code craps out? $item_file = $r['item_numb']; $item_file .= '.php'; $file_location = "$_SERVER['DOCUMENT_ROOT'].'/mall/$merchantdir/$item_file'"; Line # cause me to have a blank screen...any thoughts? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted December 17, 2007 Share Posted December 17, 2007 Can someone tell me why this bit of code craps out? $item_file = $r['item_numb']; $item_file .= '.php'; $file_location = "$_SERVER['DOCUMENT_ROOT'].'/mall/$merchantdir/$item_file'"; Line # cause me to have a blank screen...any thoughts? what do you do with the string $file_location??? Quote Link to comment Share on other sites More sharing options...
woocha Posted December 17, 2007 Author Share Posted December 17, 2007 checking to see if it exists one folder back from the execute script on the server Quote Link to comment Share on other sites More sharing options...
paul2463 Posted December 17, 2007 Share Posted December 17, 2007 when you said it leads to a blank page, are you directing the browser to the address $file_location? Quote Link to comment Share on other sites More sharing options...
woocha Posted December 17, 2007 Author Share Posted December 17, 2007 no... here the more of the code...soryy if I wasn't being descriptive enough...I am eating cheezey curls $item_file = $r['item_numb']; $item_file .= '.php'; $file_location = "$_SERVER['DOCUMENT_ROOT'].'/mall/$merchantdir/$item_file'"; if(file_exists($file_location)) { echo "<td valign=top align=center><font size=2>".$item_file; } else { something else} when I replace $file_location = "$_SERVER['DOCUMENT_ROOT'].'/mall/$merchantdir/$item_file'"; with a direct http://www.example.com//mall/$merchantdir/$item_file, the script works fine, But I really want to know why i can't use the doc root instead of the direct path Quote Link to comment Share on other sites More sharing options...
paul2463 Posted December 17, 2007 Share Posted December 17, 2007 try this <?php $item_file = $r['item_numb']; $item_file .= '.php'; $root = $_SERVER['DOCUMENT_ROOT']; $file_location = "$root/mall/$merchantdir/$item_file"; if(file_exists($file_location)) { echo "<td valign=top align=center><font size=2>".$item_file; } else { something else} ?> Quote Link to comment Share on other sites More sharing options...
woocha Posted December 17, 2007 Author Share Posted December 17, 2007 That worked out great....Thank you 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.