ranking database record and display the record at random
Posted: Mon Jul 11, 2005 10:20 am
Hi Everyone.
I'm try to retrieve data from a database, displaying record at random and rank them according to the value of a field in my database called DisplayOrder.
I Have a field called DisplayOrder, using the SQL statement below I can display the database record in display order
sql_query = "SELECT * FROM mod_en WHERE StartDate <= '$currdate' AND EndDate >= '$currdate' ORDER BY DisplayOrder ASC LIMIT 4";
I'm trying to display the data at random but keeping the display order. Using both the RAND and ORDER BY doesnt work. I dont know whether I need to write some separate PHP code to achieve this.
Can anyone help please.
I'm try to retrieve data from a database, displaying record at random and rank them according to the value of a field in my database called DisplayOrder.
I Have a field called DisplayOrder, using the SQL statement below I can display the database record in display order
sql_query = "SELECT * FROM mod_en WHERE StartDate <= '$currdate' AND EndDate >= '$currdate' ORDER BY DisplayOrder ASC LIMIT 4";
I'm trying to display the data at random but keeping the display order. Using both the RAND and ORDER BY doesnt work. I dont know whether I need to write some separate PHP code to achieve this.
Can anyone help please.