Just nu i M3-nätverket
Jump to content

problem


Micko

Recommended Posts

Har gjort ett litet bannersystem...

id = värde som alla nya kampanjer får

id2 = ett värde mellan 1-20 ( visas max 20 banners )

 

Nu är detta problemet, körde igång sidan idag men nu vägrar den att växla

banners... den visar bara 1 468banner ( banner1 ) och 1 120banner

( banner2 ).

Sen när jag kollar vad vis ( antal visningar ) står den bara på 1.

vad ska jag göra?!

koden är nedanför:

 

<%

Function Fecha

 

Dia = DatePart("D", Date)

Mese = DatePart("M", Date)

ano = DatePart("YYYY", Date)

 

Select Case(mese)

Case "1"

mes = "Jan"

Case "2"

mes = "Feb"

Case "3"

mes = "Mar"

Case "4"

mes = "Apr"

Case "5"

mes = "May"

Case "6"

mes = "Jun"

Case "7"

mes = "Jul"

Case "8"

mes = "Aug"

Case "9"

mes = "Sep"

Case "10"

mes = "Oct"

Case "11"

mes = "Nov"

Case "12"

mes = "Dec"

End Select

Fecha = dia & "-" & mes & "-" & ano

end Function

 

 

Set Connection = Server.CreateObject("ADODB.Connection")

Connection.Open Application("ads")

SQL = "SELECT Count(*) AS antal From banners WHERE hits < maxhits "

SQL = SQL & "AND vis < maxvis "

SQL = SQL & "AND aktiv = 'ja' "

SQL = SQL & "AND storlek = '468' "

SQL = SQL & "AND slutdatum > #" & fecha & "# "

SET RS = Connection.Execute(SQL)

 

antal = rs("antal")

Randomize antal

antal2 = Int(RND * antal) + 1

 

RS.close

 

 

Set RS = Connection.Execute("SELECT * FROM banners where ID2 = " & antal2 &

"")

banner1url = rs("id")

banner1pic = rs("bildnamn")

rs.close

sqltemp = "UPDATE banners SET vis='"

sqltemp = sqltemp & vis +1 & "'"

sqltemp = sqltemp & " WHERE id=" & banner1url & " "

connection.execute(sqltemp)

 

 

 

SQL = "SELECT Count(*) AS bntal From banners WHERE hits < maxhits "

SQL = SQL & "AND vis < maxvis "

SQL = SQL & "AND aktiv = 'ja' "

SQL = SQL & "AND storlek = '120' "

SQL = SQL & "AND slutdatum > #" & fecha & "# "

SET RS = Connection.Execute(SQL)

 

bntal = rs("bntal")

Randomize bntal

bntal2 = Int(RND * bntal) + 1

bntal3 = bntal2 + 20

 

RS.close

 

Set RS = Connection.Execute("SELECT * FROM banners where ID2 = " & bntal3 &

"")

banner2url = rs("id")

banner2pic = rs("bildnamn")

rs.close

 

sqltemp = "UPDATE banners SET vis='"

sqltemp = sqltemp & vis +1 & "'"

sqltemp = sqltemp & " WHERE id=" & banner2url & " "

connection.execute(sqltemp)

 

 

connection.close

set connection=nothing

%>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...