Hi, with this code i access the database table and get the image name in it. (Tested if the img name is correct here: http://www.aerix.org/test.php). Then script defines a variable. $test1 = "http://www.aerix.org/infusions/flash_games_system/puzzle/".$data['File'].""; Code (markup): If it finds the file (named in MySQL table), it echos the img. If it doesnt find it, it will change dir and FIND image there. Img has to be in one of these 2. Help me out please: <?php require_once "maincore.php"; $result = dbquery("SELECT File, Date FROM fusion_flashgames_log ORDER BY Date DESC LIMIT 0,1 "); if (dbrows($result) != 0) { $data = dbarray($result); openside("Uus Flashmäng"); $test1 = "http://www.aerix.org/infusions/flash_games_system/puzzle/".$data['File'].""; if (file_exists($test1)) { echo "<img src='http://www.aerix.org/infusions/flash_games_system/puzzle/".$data['File']."'>"; } else { echo "<img src='http://www.aerix.org/infusions/flash_games_system/notinpuzzle/".$data['File']."'>"; } closeside(); } ?> Code (markup): PROBLEM: It never finds the file defined by variable test1 and displays the second echo: .../notinpuzzle/... Appreciate your time
you are using too much variables in test1 try to remove them and use simple url test it and then make it more general I am sure this will help Regards Alex
It didt work, i used $test1 = "http://www.aerix.org/index.php"; Code (markup): And i need the changing variable in this line. ".$data['File']." Code (markup): is vital. Ty for reply.
for checking if a file exists on url use this $fUrl = "http://www.aerix.org/index.php"; $ders = @get_headers($fUrl); if (preg_match("|200|", $ders[0])) { // file exists } else { // file doesn't exists } Regards Alex
Used this now and it didnt work: <?php require_once "maincore.php"; $result = dbquery("SELECT File, Date FROM fusion_flashgames_log ORDER BY Date DESC LIMIT 0,1 "); if (dbrows($result) != 0) { $data = dbarray($result); openside("Uus Flashmäng"); $fUrl = "http://www.aerix.org/index.php"; $ders = @get_headers($fUrl); if (preg_match("|200|", $ders[0])) { echo "<img src='http://www.aerix.org/infusions/flash_games_system/puzzle/".$data['File']."'>"; } else { echo "<img src='http://www.aerix.org/infusions/flash_games_system/notinpuzzle/".$data['File']."'>"; } closeside(); } ?> Code (markup): Same result. No pic, no errors.