ORDER by two column problem
Posted: Mon Jan 30, 2006 11:38 am
Hi,
I am trying to ORDER by two columns.
The results are correct except it seems to only be sorting by the first value (vehicles.$orderby).
If I echo the values of $orderby and $orderby the values are as expected.
If I take the:
and replace with:
the results are still only sorted by the year.
Thanks
I am trying to ORDER by two columns.
Code: Select all
$inventory_list = "SELECT * FROM vehicles, inv_type
WHERE inv_type.inv_type_name = '$_GET[get_inventory]'
AND vehicles.inv_type_id = inv_type.inv_type_id
AND vehicles.vehicle_active = 1
ORDER by vehicles.$orderby, vehicles.$orderby2 $sortby
LIMIT $offset, $rowsPerPage";If I echo the values of $orderby and $orderby the values are as expected.
If I take the:
Code: Select all
ORDER by vehicles.$orderby, vehicles.$orderby2 $sortbyCode: Select all
ORDER by year, price $sortbyThanks