Jump to content

[SOLVED] include error


ohdang888

Recommended Posts

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

<?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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.