ohdang888 Posted December 31, 2007 Share Posted December 31, 2007 i use a query to get the info of game_file_url now i want to but it in an include <?php $gamefile = stripslashes($row['game_file_url']); include("$gamefile"); ?> but i am getting this error from it: Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\game.php on line 23 Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/ Share on other sites More sharing options...
rajivgonsalves Posted December 31, 2007 Share Posted December 31, 2007 your $row['game_file_url'] is null can you post some more code ? Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426427 Share on other sites More sharing options...
ohdang888 Posted December 31, 2007 Author Share Posted December 31, 2007 <?php function sql_quote($data) { if (get_magic_quotes_gpc()) { $data = stripslashes($data); } return addslashes($data); } $game = sql_quote($_GET['title']); mysql_connect("localhost", "---", "-----") or die(mysql_error()); mysql_select_db("games") or die(mysql_error()); $result = mysql_query("SELECT `author`,`title`,`author_url`,`type`,`flash`,`game_picture_url`,`game_file_name`,`instructions` FROM `game` WHERE `title`='{$game}'") or die(mysql_error()); $row = mysql_fetch_array($result); ?> <!--------------------------------- END - QUERY TO GET GT GAME INFO--------------------------> <?php $gamefile = stripslashes($row['game_file_url']); include("$gamefile"); ?> Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426729 Share on other sites More sharing options...
wildteen88 Posted December 31, 2007 Share Posted December 31, 2007 There is no field called game_file_url being returned from the SQL query in the above code. However there is a field called game_file_name do you mean to use that instead? Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426737 Share on other sites More sharing options...
revraz Posted December 31, 2007 Share Posted December 31, 2007 Even if there was, he is using an ARRAY and not an ASSOC. Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426739 Share on other sites More sharing options...
wildteen88 Posted December 31, 2007 Share Posted December 31, 2007 Even if there was, he is using an ARRAY and not an ASSOC. mysql_fetch_array returns both an associative array ($row[abc]) and a numerical array ($row[0]) Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426747 Share on other sites More sharing options...
ohdang888 Posted December 31, 2007 Author Share Posted December 31, 2007 no. wildteen88 was right. however, when i call the gamefile, and the gamefile comes, i am getting this error from it.... Warning: Unexpected character in input: '' (ASCII=19) state=1 in C:\xampp\htdocs\gamefile\1starship.swf on line 45 Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\gamefile\1starship.swf on line 45 this was my code <?php $gamefile = stripslashes($row['game_file_url']); include("gamefile/$gamefile"); ?> the game file is stored in a different folder, and its giving me that error when i get it.(the game of this game is "1starship"). HOWEVER, if that file is lcoated in the same folder as the page its going to, then it doesn;t give me that error? why is that? Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426749 Share on other sites More sharing options...
wildteen88 Posted December 31, 2007 Share Posted December 31, 2007 Is that swf file a flash object? If so you shouldn't be using include in that mannor. You only use include on files which only contain PHP code. You don't use it to include images/objects into your page. If you want to include an flash object (swf file) into your web page you'll need to use the relevant html code for that. Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426752 Share on other sites More sharing options...
ohdang888 Posted December 31, 2007 Author Share Posted December 31, 2007 well what code is that? the long html code the game comes with? Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426755 Share on other sites More sharing options...
wildteen88 Posted December 31, 2007 Share Posted December 31, 2007 well what code is that? the long html code the game comes with? Correct. Link to comment https://forums.phpfreaks.com/topic/83810-solved-include-error/#findComment-426756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.