SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    if statment problem

    hello
    i have this code for authorization ip
    PHP Code:
    <?php 
    require_once('../Connections/config.php'); 
    $ip $_SERVER['REMOTE_ADDR'];
    mysql_query("DELETE FROM ip_addresses WHERE ip_addresses_date < DATE_SUB(NOW(), INTERVAL 24 HOUR)");
    $query1 "select * from ip_addresses where ip_addresses_number = '123'";
    $result1 = @mysql_query ($query1,$config) or trigger_error(mysql_error(),E_USER_ERROR);
    if(
    $result1){
        echo 
    "yes";
    }else{
        echo 
    "hi";
    }
    ?>
    simply the result still giving me yes however the ip_addreeses table is empty of rows
    how??!

  2. #2
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i found it
    Code:
    if(mysql_num_rows($result1) > 0){
    thank u all

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,065
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    @egyzaman ; Please be aware that the mysql_* extension is now deprecated as of the current version of PHP and will very likely be removed from the next 5.x version and will likely not be in PHP 6.x (when it eventually is released). You should migrate over to either the mysqli_* extension or to PDO. PDO is a better choice as it doesn't tie you down so much to a particular database server software.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •