This topic is locked
[SOLVED]

 Orderby - list page

9/17/2010 7:27:38 AM
ASPRunnerPro General questions
S
Scruffy author

I've assigned some custom code to a field, eg if the field is null it assigns a default value.
Is it possible to now re-order the table to include these added values?
At present the null values are at the start.
TIA

Sergey Kornilov admin 9/17/2010

You cannot sort your data by value set in PHP code.
The best approach here is to perform calculations in SQL Query. Check MySQL functions IF(), CASE() and IFNULL():

http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_ifnull

S
Scruffy author 9/18/2010



You cannot sort your data by value set in PHP code.
The best approach here is to perform calculations in SQL Query. Check MySQL functions IF(), CASE() and IFNULL():

http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_ifnull


Many thanks.