Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
EDC:
Download extensions for Elxis CMS
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 2008 developers guide
»
Random ordering and ADODB
« previous
next »
Print
Pages: [
1
]
Author
Topic: Random ordering and ADODB (Read 11345 times)
datahell
Elxis Team
Hero Member
Posts: 10356
Random ordering and ADODB
«
on:
October 05, 2007, 22:45:30 »
If you wish to order randomly the results from the database then dont use "ORDER BY RAND()" as it is a native mysql function and only works on Elxis under MySQL. In this case you should use the $random variable of ADODB which is set automatically for every database type.
Instead of this:
$query = "SELECT........."
."\n ORDER BY RAND()";
Use this:
$randfunc = $database->_resource->random;
$query = "SELECT........."
."\n ORDER BY ".$randfunc;
The randomize function for MySQL is RAND() and for Postgres is RANDOM()
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 2008 developers guide
»
Random ordering and ADODB