I need alittle help, Please

Discussion in 'PHP' started by GeelongTECH, Jan 27, 2011.

  1. #1
    Hello,
    Me again

    I have a query
    select * from advertisers WHERE hits_left = '0'
    PHP:
    this query only works if hits_left = '0' but i need it to work if hits_left = '0' or if hits_left = '-1', hits_left = '-2', hits_left = '-3', ect...

    Basicly if hits_left is 0 or a -(somthing)

    The full code I'm using is
    $query_ssl="select * from advertisers WHERE hits_left = '0'";  // query string stored in a variable
    $rt_ssl=mysql_query($query_ssl);
    while($nt_ssl=mysql_fetch_array($rt_ssl)){
    @mysql_query("UPDATE advertisers SET ad_active = 'finished' WHERE site_url = '".$nt_ssl['site_url']."' AND username = '".$nt_ssl['username']."'");
    }
    PHP:
     
    GeelongTECH, Jan 27, 2011 IP
  2. FriendSwapMeet.com

    FriendSwapMeet.com Peon

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    WHERE hits_left <= '0'";
     
    FriendSwapMeet.com, Jan 27, 2011 IP
  3. drctaccess

    drctaccess Peon

    Messages:
    62
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Replace the first line with the line below.

    
    $query_ssl =  'SELECT * FROM advertisers WHERE hits_left <= 0';
    
    Code (markup):
     
    drctaccess, Jan 27, 2011 IP
  4. koula

    koula Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have a suggestion do not use quotes ('0') if the value is an integer.
     
    koula, Feb 3, 2011 IP