-4
            $oyun_inceleme=$_GET['oyun_inceleme'];
            $query = "SELECT inceleme_oyun_tag FROM incelemeler WHERE inceleme_oyun_tag = '$oyun_inceleme'";
            $sonuc = mysql_query($query);
            if(mysql_num_rows($sonuc) == 1){
            require_once "tema/sayfa/oyun_inceleme.php";
            }

i check other users topics but i couldn't solve it what i did wrong ? i waiting php and mysql masters. ..........

  • I can't believe that none of the other questions told you to check whether `mysql_query()` is successful and `echo mysql_error()` when it fails. – Barmar Nov 19 '13 at 21:32
  • If you had checked other topics such as the list over in the "related" section on the right, you would see that you _must_ do error checking on the result of `mysql_query()`. You have no such error checking, and just assume that the query was successful. A single quote in your `$_GET` param will break your query since it is unescaped. – Michael Berkowski Nov 19 '13 at 21:32
  • When you echo out the `$query` I would be pretty confident that you haven't got the `$oyun_inceleme` set when you try to run it. – Fluffeh Nov 19 '13 at 21:33
  • You didn't look hard enough (I'm betting you didn't look AT ALL). Your query failed. You assumed success. Your code has now blundered onwards leaving a trail of chaos and destruction its wake – Marc B Nov 19 '13 at 21:33
  • Before you continue with this, back up and read through http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php – Michael Berkowski Nov 19 '13 at 21:36
  • i used mysqli_query and mysqli_num_rows instead of mysql problem solved but whats difference between mysql and mysqli – Mehmet Altıntaş Nov 19 '13 at 22:02

1 Answers1

0

mysqli_query returned you false value. You should check it before using:

if($sonuc && mysql_num_rows($sonuc) == 1){
  require_once "tema/sayfa/oyun_inceleme.php";
}
sybear
  • 7,789
  • 1
  • 21
  • 38