random rows (asp -> php)?

admin

Administrator
Staff member
Hi!

I'm moving from ASP -> PHP and converting all my sites, but I have no qlue how to convert the code below where I'm getting three random rows from a table. The important is that they never show the same row at the same time.
Otherwise...
"SELECT * FROM table ORDER BY rand() limit 1";
...had worked fine.

<%
Randomize Timer
intRnd = (Int(Rnd * recset.RecordCount))

Set rs = Server.CreateObject("ADODB.Recordset")
Sql = "SELECT * FROM table"
rs.Open Sql, conn, 3, , adCmdText

rs.Move intRnd
Response.Write rs("header")
rs.MoveNext

If rs.EOF = True Then rs.MoveFirst
Response.Write rs("header")
recset.MoveNext

If rs.EOF = True Then rs.MoveFirst
Response.Write rs("header")

rs.Close
Set rs = Nothing

%>

This in PHP????
 
Back
Top