Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.