| |
|
|
|
 |
|
<%
Set con = Server.CreateObject("ADODB.Connection")
con.open "pancorbo.info.hogarmotos"
set rst=Server.createobject("ADODB.Recordset")
rst.cursorlocation = 3
sql = "select * from motos"
rst.open sql,con
if not rst.EOF then%>
<%nreg = rst.recordCount
if nreg = 1 then
id1 = rst("id")
foto1 = rst("mini")
rst.Close
else
if nreg = 2 then
id1 = rst("id")
foto1 = rst("mini")
rst.Close
sql = "select * from motos where id <>"&id1
rst.open sql,con
if not rst.EOF then
id2 = rst("id")
foto2 = rst("mini")
end if
rst.Close
else
if nreg >= 3 then
tabla = rst.GetRows
nreg = rst.recordCount
RANDOMIZE
random = Int((nreg) * Rnd)
id1 = tabla(0,random)
foto1 = tabla(15,random)
rst.Close
sql = "select * from motos where id <>"&id1
rst.open sql,con
if not rst.EOF then
tabla = rst.GetRows
nreg = rst.recordCount
RANDOMIZE
random = Int((nreg) * Rnd)
id2 = tabla(0,random)
foto2 = tabla(15,random)
end if
rst.Close
sql = "select * from motos where id <>"&id1
rst.open sql,con
if not rst.EOF then
tabla = rst.GetRows
nreg = rst.recordCount
RANDOMIZE
random = Int((nreg) * Rnd)
id2 = tabla(0,random)
foto2 = tabla(15,random)
end if
rst.Close
sql = "select * from motos where id <>"&id1&" and id <>"&id2
rst.open sql,con
if not rst.EOF then
tabla = rst.GetRows
nreg = rst.recordCount
RANDOMIZE
random = Int((nreg) * Rnd)
id3 = tabla(0,random)
foto3 = tabla(15,random)
end if
rst.Close
end if
end if
end if
%>
<%if foto1<>"" then%>
<%end if%>
<%if foto2<>"" then%>
<%end if%>
<%if foto3<>"" then%>
<%end if%>
<%end if
%>
|
|
|
|