...

View Full Version : why everything is on the same line



rossy77
08-10-2005, 05:14 PM
I'm following an online example.
I'm trying to put the results of a query on a table but everything appears on the same line..what's wrong with this code??

<table border=1><tr><td><strong>Numero foto</strong></td><td><strong>Nome foto</strong></tr>
<% While Not RS.EOF
Response.Write("</td><td>")
%><%=(RS.Fields.Item("FOTO_ID").Value)%><%
Response.Write("</td><td>")
%><%=(RS.Fields.Item("FOTO_Nome_foto").Value)%><%
RS.Movenext
Wend %>
</td></tr></table>

Brandoe85
08-10-2005, 06:00 PM
Try:


<table border=1><tr><td><strong>Numero foto</strong></td><td><strong>Nome foto</strong></tr>
<%
While Not RS.EOF
Response.Write("<tr>")
Response.Write("<td>" & RS.Fields.Item("FOTO_ID").Value & "</td>")
Response.Write("<td>" & RS.Fields.Item("FOTO_Nome_foto").Value & "</td>")
Response.Write("</tr>")
RS.MoveNext
Wend
%>
</table>


Good luck

SpirtOfGrandeur
08-10-2005, 06:08 PM
Just a little edit...

Try:


<table border=1><tr><td><strong>Numero foto</strong></td><td><strong>Nome foto</strong></tr>
<%
While Not RS.EOF
Response.Write("<tr>" & vbcrlf)
Response.Write("<td>" & RS.Fields.Item("FOTO_ID").Value & "</td>" & vbcrlf)
Response.Write("<td>" & RS.Fields.Item("FOTO_Nome_foto").Value & "</td>" & vbcrlf)
Response.Write("</tr>" & vbcrlf)
RS.MoveNext
Wend
%>
</table>


Actually I am feeling really nice today. So I will show you a good example of this :)



Dim SQL, ADO, RST

SET ADO = Server.CreateObject("ADODB.Connection")
ADO.ConnectionString = "Your Connection String"
if ADO.State = 0 then ADO.Open

SQL = " Select FOTO_ID as 'Numero foto', FOTO_Nome_foto as 'Nome foto' From FOTO Where FOTO_ID = 3"


SET RST = Server.CreateObject("ADODB.Recordset")
RST.CursorLocation = 3
RST.Open SQL, ADO, 0, 1
Set RST.ActiveConnection = Nothing

If Not RST.EOF then
Response.Write("<table>" & vbcrlf)
Response.Write("<thead>" & vbcrlf)
Response.Write("<tr>" & vbcrlf)
For Each q in RST.Fields
Response.Write("<td>" & q.name & "</td>" & vbcrlf)
next
Response.Write("<tr>" & vbcrlf)
Response.Write("</thead>" & vbcrlf)
Response.Write("<tbody>" & vbcrlf)
RST.MoveFirst()
Do while Not RST.EOF
Response.Write("<tr>" & vbcrlf)
For Each q in RST.Fields
Response.Write("<td>" & q & "</td>" & vbcrlf)
next
Response.Write("<tr>" & vbcrlf)
RST.MoveNext()
Loop
Response.Write("</tbody>" & vbcrlf)
Response.Write("</table>" & vbcrlf)
end if

rossy77
08-10-2005, 06:16 PM
thanks both,I need a guide to Asp and databases!!

CrzySdrs
08-10-2005, 06:27 PM
ASP:
www.w3schools.com/asp
ASP Database Connections
www.w3schools.com/ado
Structured Query Language (SQL) for talking to DB's
www.w3schools.com/sql

Those should be a few good guides. If you need anything else, a good Google search would probably help.

rossy77
08-10-2005, 06:30 PM
thanks all from a desperate Italian girl

neocool00
08-10-2005, 07:39 PM
@SpirtOfGrandeur,
I've seen THeader and TBody tags before, but what purpose do they serve? I've never used them myself, but I've seen sites done by others that have.

--Neo

SpirtOfGrandeur
08-10-2005, 08:34 PM
@SpirtOfGrandeur,
I've seen THeader and TBody tags before, but what purpose do they serve? I've never used them myself, but I've seen sites done by others that have.

--Neo


They are actually part of a poperly formatted table. And then after that they make JS easier to use on the table itself.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum