SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    more than certain number

    Hi guys

    if i wanted to show all listings with more than 5 applications how would i do it

    I have this if i want to show all records with 0 applications

    PHP Code:
    $sql = ("select * from jobs WHERE applications='0'"); 

    I guess it would be something similar?

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    simple operators
    > greater than
    < less than
    = equal to
    != not equal to

    Code:
    (select * from jobs where applications >= 5);
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,323
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by spikeZ View Post
    != not equal to
    <> not equal to, sql standard
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you

    how about rows that have been added in the last 24 hours?

    what would be the logic?

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    heres a snippet for the last 7 days. should be easy to alter
    PHP Code:
    <?php
    $now 
    time(); // this is the current UNIX timestamp for the server
    $days 7// change to number of days
    $days_ago date("Y-m-d H:i:s", ($now - (86400 $days));
     
    $query "SELECT username FROM users WHERE lastvisited > '$days_ago'";
     
    $result = @mysql_query($query);
     if(@
    mysql_num_rows($result)) {
            while(
    $row mysql_fetch_row($result)) {
                 print 
    "$row[0] <br />";
           }
     }
    ?>
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •