Results 1 to 2 of 2

Thread: performing a sort

  1. #1
    Join Date
    Jun 2005
    Location
    coronado
    Posts
    76

    performing a sort

    I have a mysql query which runs fine and i'm trying to perform a sort on 1 of the columns (priority) which (when that variable is set) returns results from the prevous query with the priority choosen (A, B, C) herre's what I have, but Is thereee a way to do this which wouldn't involve running a query on the database again? (maybe the LIMIT clause)
    PHP Code:
    $sql="select *, DATE_FORMAT(a_date, '%m/%d/%Y') as a_date_formatted from company, activity where c_id=a_c_id and medivas ='$poc'  group by medivas";
    $query=mysql_query($sql);
    $numofrows mysql_num_rows($query);
    if (isset(
    $priority)) {
    $sql1="select *, DATE_FORMAT(a_date, '%m/%d/%Y') as a_date_formatted from company, activity where c_id=a_c_id and medivas ='$poc' and priority ='$priority'";
    $query1=mysql_query($sql1) or die(mysql_error());

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    coronado
    Posts
    76
    Maybe I didn't explain what im trying to do. When the page loads and the first query is run, everything is fine and the results are displayed in multiple columns, one of the columns name is priority, whose values are either 1, 2, or 3. What im trying to do is display the results (from the first query) depending on which priority is selected (1, 2, or 3)

Posting Permissions

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