Skip to main content
gamedev.net
🔒 Locked

[PHP] Include problem...driving me NUTS.

Started by GenmaC Jan 26, 2004 at 8:06 PM 6 replies 400+ views
Original Post
GenmaC
GenmaC
Here''s the relevant code:
function igm_process($section){
                $sql = "SELECT * FROM ".getsetting("dbprefix","logd_")."igms WHERE section=\"$section\" AND enabled=1 ORDER BY igmid";
                $result = db_query($sql)or die(db_error(LINK));
                // Grab the filenames and menunames
                while($row = mysql_fetch_array($result)){
                $file = $row[''dir'']."/".$row[''class''];
                if(!strstr($file,".php")) $file = $file.".php";
                include($file) or die("Notify sysop: Unable to include ".$temp);
                }

                db_free_result($result);
}
 
If I echo the $file variable, it prints out fine. I''ve even explicitly set $file to a string type, but I continually receive this error for every file I try to include: Warning: igm_process(1): failed to open stream: No such file or directory in W:\www\logddev\igm_api.php on line 85 Warning: igm_process(): Failed opening ''1'' for inclusion (include_path=''.;/usr/local/PHP/includes;/usr/local/PHP/pear;./;./www/logddev'') in W:\www\logddev\igm_api.php on line 85
Puzzler183
Puzzler183
Maybe if you are on linux, it wants all of the slashes a certain way, and the case to be correct... Can''t help you past that.
Michalson
Michalson
Yes, Linux could pose several problems. First is slashes, the second is that it is case sensitive.
Kylotan
Kylotan
The "include($file) or die()" idea is a pretty bad one. include() shoves the entire file into the code at that point. If you want to persist with this bizarre method, it seems that operator precedence may be your undoing. Try this:

@(include($file)) or die("Notify sysop: Unable to include ".$temp);

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.