'ORDER BY' question

W

wallaceb

Guest
Just started playing with DaDaBik 2.2.1 beta. I have a question, though. Let's say I have a db with 4 columns: Item, Product Number, Manufacturer, and Price. Item is the primary key. I'd like to sort by Price, in descending order. Simple from an SQL standpoint, but I can't find in the code where to do it. Any help would be greatly appreciated.
 
K

Kristen

Guest
I was playing around with this, trying to get it to work, and I think this does it:

on form.php set the variable order to the field you want it to order by. In my case I did:

$order = "lastname";

I put it right before the switch statement in form.php that starts like:
switch($function){

If you put it at the beginning of the file it doesn't work, so be sure to put it right above the switch statement.

I am not a programmer or anything, so if this doesn't work I'm sorry!

Kristen
 
E

Eugenio

Guest
Kristen wrote:
>
> I'm not sure how to get decending order, though. :(

I haven't tried it, but I think it should be enough to change thiese lines in form.php:

if ($order != ""){
$sql .= " order by ".$quote.$order.$quote;
} // end if

with:

if ($order != ""){
$sql .= " order by ".$quote.$order.$quote.' DESC';
} // end if

Eugenio.

(Latest version of DaDaBIK when this message was posted: 2.2.1)
 
Top