Problemet er coins er på 50 og userscoins 40 og hvis coins er større end userscoins så er download deaktiveret men er userscoins større end coins så er download ikke deaktiveret.
Men skriver jeg 400 i usercoins og coins er stadig 50 så er download stadig deaktiveret det er om om den kun tager de 2 første tal
for skriver jeg 600 i users coins så er download ikke deaktiveret.
Kommer lige med min kode her.
Kode: Vælg alt
Function GetCoinsFromUserSession
Call OpenDataBase
Dim objRS
Dim intResult
intResult = ""
Set objRS = objConn.Execute("SELECT * FROM customers WHERE ID=" & Session("FuUserID"))
If (Not objRS.BOF) And (Not objRS.EOF) Then
intResult = CLng(objRS("Coins"))
End If
objRS.Close
Set objRS = Nothing
Call CloseDataBase
GetCoinsFromUserSession = FixResult
End Function
Function GetCoinsFromFile
Call OpenDataBase
Dim objRS
Dim intResult
intResult = ""
Set objRS = objConn.Execute("SELECT Coins FROM produktvare WHERE ID=" & GetNumericQueryString("ID"))
If (Not objRS.BOF) And (Not objRS.EOF) Then
intResult = CLng(objRS("Coins"))
End If
objRS.Close
Set objRS = Nothing
Call CloseDataBase
GetCoinsFromUserFile = intResult
End Function
Har også prøvet at lave dem sådan her
Kode: Vælg alt
Function GetCoinsFromUserSession
Call OpenDataBase
Dim objRS
Dim intResult
intResult = ""
Set objRS = objConn.Execute("SELECT * FROM customers WHERE ID=" & Session("FuUserID"))
If (Not objRS.BOF) And (Not objRS.EOF) Then
intResult = objRS("Coins")
End If
objRS.Close
Set objRS = Nothing
Call CloseDataBase
GetCoinsFromUserSession = FixResult
End Function
Function GetCoinsFromFile
Call OpenDataBase
Dim objRS
Dim intResult
intResult = ""
Set objRS = objConn.Execute("SELECT Coins FROM produktvare WHERE ID=" & GetNumericQueryString("ID"))
If (Not objRS.BOF) And (Not objRS.EOF) Then
intResult = objRS("Coins")
End If
objRS.Close
Set objRS = Nothing
Call CloseDataBase
GetCoinsFromUserFile = intResult
End Function
Og her kommer så hvor jeg tjekker om coins er større end usercoins
Kode: Vælg alt
If GetCraftCoinsFromUserSession > GetCoinsFromUserSession Then
Response.Write "du har ikke nok på kontoen"
Else
End if
Kode: Vælg alt
If GetCoinsFromUserSession > objRS("CraftCoins") Then
Response.Write "du har ikke nok på kontoen"
Else
End if