Jump to content

zuper89

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by zuper89

  1. How do i do to have only 16 pictures on every site?Please help me, all i have found on tutorials is for records in a database.Heres what i looks like know, but there is a folder that contains 115 MB of pictures and when it loads all of them on one page it is a bit of lagg.

    <%Const ForReading = 1, ForWriting = 2, ForAppending = 3Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0qfolder = request.querystring("galleri")if qfolder = "" then	folderspec = server.mappath("bilder\galleri")	Set filesys = CreateObject("Scripting.FileSystemObject") 	Set demofolder = filesys.GetFolder(folderspec) 	Set folcoll = demofolder.SubFolders	For Each subfol in folcoll  folsize = left((subfol.size/1000000), 3)     folist = folist & "<a href='?side=bilder&galleri=" & subfol.name & "'>" & subfol.Name & " </a><small> (" & folsize & " MB)</small>" & vbcrlf     folist = folist & "<BR>"  	Next	set filesys = nothing	Response.Write "<center>" & folist & "</center>"elsefilepath = server.mappath("bilder\galleri") & "\" & qfolderSet filesys = CreateObject("Scripting.FileSystemObject")Dim SomeArray()'folder part	Set demofolder = filesys.GetFolder(filepath) 	Set filecoll = demofolder.Files	filecount = 0	i         = 0%><h2><%=qfolder%></h2><table width="400" cellpadding="3" cellspacing="0"> <tr><%	For Each file in filecoll  Ext = UCase(Right(File.Path, 3))   If Ext = "JPG" OR Ext = "GIF" Then  on error resume next  data = SomeArray(filecount)  on error goto 0  hrefpath = "bilder\galleri\" & qfolder & "/" & file.name%>  <td align="center">   <a href="<%=hrefpath%>">    <img src="<%=hrefpath%>" width="80" border="0" alt="Bilde">   </a>  </td><% i=i+1IF i=4 THENi=0 %> </tr> <tr><%end if  filecount = filecount + 1  data = ""  end if	Next%> </tr></table><%	set filesys = Nothing	 end if %>

  2. this is how i done it:

    DIM objConnKOSet objConnKO = Server.CreateObject("ADODB.Connection")objConnKO.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db3 & ";"objConnKO.OpenobjConnKO.Execute("CREATE TABLE news"& id &" (ko_id integer auto_increment, ko_kommentar varchar, ko_navn varchar(30), ko_ip varchar(15), ko_dato datetime, PRIMARY KEY (ko_id));")

  3. MySQL: CREATE TABLE Customer (SID integer AUTO_INCREMENT, Last_Name varchar(30), First_Name varchar(30), PRIMARY KEY (SID));

    it dosn't work when I insert AUTO_INCREMENT, it works fine without :)so, if you have any other idea please say it :)
  4. MySQL: CREATE TABLE Customer (SID integer, Last_Name varchar(30), First_Name varchar(30), PRIMARY KEY (SID)); Oracle: CREATE TABLE Customer (SID integer PRIMARY KEY, Last_Name varchar(30), First_Name varchar(30)); SQL Server: CREATE TABLE Customer (SID integer PRIMARY KEY, Last_Name varchar(30), First_Name varchar(30));

    Thanks :)but i need the id to be auto increment ? how do i do that ?
  5. I have read the w3school Tutorials and dont get that much information to create a table with a colum that is primary key and auto increment.here is what it should be-------id - primary key and auto incrementcomment - varcharname - varcharip - varchar ?date - datetime-------and the table name should be "news + the id from an other database that is created at the same time" for an example "news14"I had done like this:(but i dont work)

    ElseIf Request.QueryString("do") = "add-2" Then   navn       = Session("navn")   overskrift = Request.Form("overskrift")   del1       = Fixa(Request.Form("del1"))   del2       = Fixa(Request.Form("del2"))   objConnNY.Execute("Insert Into nyheter(ny_navn, ny_overskrift, ny_del1, ny_del2) Values('"& navn &"','"& overskrift &"','"& del1 &"','"& del2 &"')")   Response.Redirect "?vis=nyheter"mySQLNY2 = "Select * from nyheter where ny_overskrift="& overskrift &""objNY.Open mySQLNY2, objConnNYDIM objConnKOSet objConnKO = Server.CreateObject("ADODB.Connection")objConnKO.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db3 & ";"objConnKO.Openid = objNY("ny_id")   objConnKO.Execute("CREATE TABLE news"& id &" (ko_id AUTO_INCREMENT PRIMARY, ko_kommentar varchar, ko_navn varchar(25), ko_ip varchar, ko_dato datetime)")

    Thanks :)

  6. PLEASE !!Can anyone please tell me whats wrong?PLEASE !!

    <%DIM objConnSet objConn = Server.CreateObject("ADODB.Connection")objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/timerussen.mdb") & ";"objConn.OpenmySQL = "SELECT * FROM poll"DIM objPLSet objPL = Server.CreateObject("ADODB.Recordset")objPL.Open mySQL, objConndim pollpoll=Request.Form("poll")%><form action="" method="post"><table>  <tr>    <td colspan="2"><% Response.Write objPL("po_sporsmal") %></td>  </tr><%If objPL("po_svar1") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar1" then Response.Write("checked")%> value="po_svar1"></input> </td>    <td><% Response.Write objPL("po_svar1") %></td>  </tr><%End IfIf objPL("po_svar2") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar2" then Response.Write("checked")%> value="po_svar2"></input> </td>    <td><% Response.Write objPL("po_svar2") %></td>  </tr><%End If%>  <tr>    <td><input type="submit" value="Vote" /></td>    </tr></table><%if poll<>"" thenobjPL.UPDATE pollobjPL.SET " & poll & " = " & poll & " +1objPL.WHERE po_id = objPL("po_id")end ifobjPL.Closeset objPL = NothingobjConn.CloseSet objConn = Nothing%>

    PLEASE !!Can anyone please tell me whats wrong?PLEASE !!

  7. Can anyone tell me how to update a database,I have read the sql tutorials, and dosnt get that much information, because i not sure how to connect to a database when im going to update. And i dont find any place where it is explained how to do that, so, if you now it, why dont you tell me ?

  8. What is wrong, why dosnt it work ?

    <%DIM objConnSet objConn = Server.CreateObject("ADODB.Connection")objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/timerussen.mdb") & ";"objConn.OpenmySQL = "SELECT * FROM poll"DIM objPLSet objPL = Server.CreateObject("ADODB.Recordset")objPL.Open mySQL, objConndim pollpoll=Request.Form("poll")%><form action="" method="post"><table>  <tr>    <td colspan="2"><% Response.Write objPL("po_sporsmal") %></td>  </tr><%If objPL("po_svar1") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar1" then Response.Write("checked")%> value="po_svar1"></input> </td>    <td><% Response.Write objPL("po_svar1") %></td>  </tr><%End IfIf objPL("po_svar2") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar2" then Response.Write("checked")%> value="po_svar2"></input> </td>    <td><% Response.Write objPL("po_svar2") %></td>  </tr><%End IfIf objPL("po_svar3") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar3" then Response.Write("checked")%> value="po_svar3"></input> </td>    <td><% Response.Write objPL("po_svar3") %></td>  </tr><%End IfIf objPL("po_svar4") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar4" then Response.Write("checked")%> value="po_svar4"></input> </td>    <td><% Response.Write objPL("po_svar4") %></td>  </tr><%End IfIf objPL("po_svar5") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar5" then Response.Write("checked")%> value="po_svar5"></input> </td>    <td><% Response.Write objPL("po_svar5") %></td>  </tr><%End IfIf objPL("po_svar6") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar6" then Response.Write("checked")%> value="po_svar6"></input> </td>    <td><% Response.Write objPL("po_svar6") %></td>  </tr><%End IfIf objPL("po_svar7") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar7" then Response.Write("checked")%> value="po_svar7"></input> </td>    <td><% Response.Write objPL("po_svar7") %></td>  </tr><%End IfIf objPL("po_svar8") <> "" Then%>  <tr>    <td><input type="radio" name="poll" <%if poll="svar8" then Response.Write("checked")%> value="po_svar8"></input> </td>    <td><% Response.Write objPL("po_svar8") %></td>  </tr><%End If%>  <tr>    <td><input type="submit" value="Vote" /></td>    </tr></table><%if poll<>"" then UPDATE poll SET " & poll & " = " & poll & " +1 WHERE po_id = Response.Write objPL("po_id")end ifobjPL.CloseSet objPL = NothingobjConn.CloseSet objConn = Nothing%>

    When I am trying to open it in explorer it says;Microsoft VBScript-kompileringsfeil error '800a0401' Forventet slutt på setning /tests/poll1.asp, line 79line 79 is; UPDATE poll SET " & poll & " = " & poll & " +1 WHERE po_id = Response.Write

  9. How can i make this much more simpler?

    <%DIM objConnSet objConn = Server.CreateObject("ADODB.Connection")objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/timerussen.mdb") & ";"objConn.OpenmySQL = "SELECT * FROM poll"DIM objPOSet objPO = Server.CreateObject("ADODB.Recordset")objPO.Open mySQL, objConn%><html><head></head><body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"><table cellpadding="0" cellspacing="0" border="0" width="400"><%DIM sumsum = (objPO("po_votes1") + objPO("po_votes2") + objPO("po_votes3") + objPO("po_votes4") + objPO("po_votes5") + objPO("po_votes6") + objPO("po_votes7") + objPO("po_votes8") )%>  <tr>    <td align="center"><b><% Response.Write objPO("po_sporsmal") %></b><br>Totalt votes: <% Response.Write(sum) %></td>  </tr></table><%If objPO("po_svar1") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar1") %></td>  </tr>  <tr>  <%  DIM votes1a, votes1b, votes1c  votes1a = (objPO("po_votes1") / sum * 100)  votes1b = (100 - votes1a)  votes1c = Round(votes1a, 2)  %>    <td background="includes/images/1.gif" height="18" width="<% Response.Write(votes1a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes1b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes1") %> (<% Response.Write(votes1c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar2") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar2") %></td>  </tr>  <tr>  <%  DIM votes2a, votes2b, votes2c  votes2a = (objPO("po_votes2") / sum * 100)  votes2b = (100 - votes2a)  votes2c = Round(votes2a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes2a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes2b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes2") %> (<% Response.Write(votes2c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar3") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar3") %></td>  </tr>  <tr>  <%  DIM votes3a, votes3b, votes3c  votes3a = (objPO("po_votes3") / sum * 100)  votes3b = (100 - votes3a)  votes3c = Round(votes3a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes3a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes3b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes3") %> (<% Response.Write(votes3c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar4") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar4") %></td>  </tr>  <tr>  <%  DIM votes4a, votes4b, votes4c  votes4a = (objPO("po_votes4") / sum * 100)  votes4b = (100 - votes4a)  votes4c = Round(votes4a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes4a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes4b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes4") %> (<% Response.Write(votes4c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar5") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar5") %></td>  </tr>  <tr>  <%  DIM votes5a, votes5b, votes5c  votes5a = (objPO("po_votes5") / sum * 100)  votes5b = (100 - votes5a)  votes5c = Round(votes5a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes5a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes5b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes5") %> (<% Response.Write(votes5c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar6") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar6") %></td>  </tr>  <tr>  <%  DIM votes6a, votes6b, votes6c  votes6a = (objPO("po_votes6") / sum * 100)  votes6b = (100 - votes6a)  votes6c = Round(votes6a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes6a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes6b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes6") %> (<% Response.Write(votes6c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar7") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar7") %></td>  </tr>  <tr>  <%  DIM votes7a, votes7b, votes7c  votes7a = (objPO("po_votes7") / sum * 100)  votes7b = (100 - votes7a)  votes7c = Round(votes7a, 2)  %> 	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes7a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes7b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes7") %> (<% Response.Write(votes7c) %>%)</i></td>  </tr></table><%End IfIf objPO("po_svar8") <> "" Then%><table cellpadding="0" cellspacing="0" border="0" width="400">  <tr>    <td colspan="2"><% Response.Write objPO("po_svar8") %></td>  </tr>  <tr>  <%  DIM votes8a, votes8b, votes8c  votes8a = (objPO("po_votes8") / sum * 100)  votes8b = (100 - votes8a)  votes8c = Round(votes8a, 2)  %>  	<td background="includes/images/1.gif" height="18" width="<% Response.Write(votes8a) %>%"></td>	<td background="includes/images/0.gif" height="18" width="<% Response.Write(votes8b) %>%"></td>  </tr>  <tr>    <td colspan="2"><i>Votes: <% Response.Write objPO("po_votes8") %> (<% Response.Write(votes8c) %>%)</i></td>  </tr></table><%End If%></body></html><%objPO.CloseSet objPO = NothingobjConn.CloseSet objConn = Nothing%>

  10. Hey guysProblem quite simple I suppose, but I can't figure it out. (kinda new at it)Got a page built up by tables and it has a rather small width and height. It looks kinda dull having it in the upper left corner all the time. So I'd like to center it in the middle of the window/body what ever.It's just one table really, so just that one thing that needs alignment.Help? :)

    <table align="center" valign="middle">
  11. I did like this, and that worked nice :);

    <%DIM sumsum = (objPO("po_votes1") + objPO("po_votes2") + objPO("po_votes3") + objPO("po_votes4") + objPO("po_votes5") + objPO("po_votes6") + objPO("po_votes7") + objPO("po_votes8") )%>

    But i got another problem, if the answer is;51,6260162601626 how do i do to let it be 51,63 ??

  12. How can i calculate information that is in a database with asp?example:I got 4 user in a databasehow can i get the avarage age og the members?example 2I 3 colons in a database table,wich is all number, how can i get the totalsum of the numbersSorry my english, Im Norwegian

×
×
  • Create New...