Ok, first, let's use placeholders for you data...  And lets use the ORDER
BY clause...

$query = prepare ("SELECT field1,field2,field3,field4 FROM table1 WHERE
field2 like 2282 AND $ like '$' ORDER BY field2");

$data = $query->execute($searchmode, $showmode);


Give that a try...

Note: I did not test this code so it may not be 100% correct...





                                                                                       
    
                    Morgan Norell                                                      
    
                    <raven@ravens        To:     [EMAIL PROTECTED]                    
    
                    oft.nu>              cc:                                           
    
                    Sent by:             Subject:     Database question?               
    
                    root@frostbyt                                                      
    
                    e.ebl.se                                                           
    
                                                                                       
    
                                                                                       
    
                    08/24/01                                                           
    
                    07:59 AM                                                           
    
                                                                                       
    
                                                                                       
    




I have a Mysql database and I use a select that looks like this

$query = sprintf("SELECT field1,field2,field3,field4 FROM table1 WHERE
field2 like 2282 AND %s like '%s'", $searchmode, $showmode);

then I take $query for processing.

My problem is that I want to sort the query by field2. I have tryed to
use sqls group by and sort by in the query abow
but it doesen't work.

Is there any other way to sort the result?




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to