SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Sort By Problem

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

    Sort By Problem

    Hi guys


    Im trying to fix a sort by error

    I want to sort by jobs with applications but there isnt a application field instead there is a application table. So I think I would want to sort by using num rows


    PHP Code:
             $checkapplications " select * from applications where job_id=$id";

     
    $numresults=mysql_query($checkapplications);
     
    $applicationrows=mysql_num_rows($numresults); 



    This is my query

    PHP Code:
    $editjobs = ("select * from Jobs where sitesystem='$sitesystem' and DATE_SUB(CURDATE(),INTERVAL '$durationofjoblisting' DAY) <=startdate   
    and user_id ='"
    $_SESSION['employer'] ."' ORDER BY"); 

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code sql:
    SELECT jobs.*
         , applications.id
         , COUNT(applications.id) AS apps
     FROM jobs
    LEFT JOIN applications
           ON applications.jobs_id=jobs.id
    WHERE sitesystem='$sitesystem' 
      AND DATE_SUB(CURDATE(),INTERVAL '$durationofjoblisting' DAY) <=startdate    
      AND user_id ='". $_SESSION['employer'] ."'
    ORDER BY apps DESC
    Saul


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
  •