How to use ASP & MySQL Display Multiple Column This is tutorial asp developers how to using ASP list data from MySQL table and display result of multiple column.
ShotDev Focus:
- ASP & MySQL list data and multiple column.
Example
asp_mysql_column.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim Conn,strSQL,objRec,intRows Set Conn = Server.Createobject("ADODB.Connection") Conn.Open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root; " & _ "pwd=root;database=mydatabase;option=16384;" strSQL = "SELECT * FROM gallery " Set objRec = Server.CreateObject("ADODB.Recordset") objRec.Open strSQL, Conn, 1,3 Response.Write("<table border='0' cellspacing='1' cellpadding='1'><tr>") intRows = 0 While Not objRec.EOF intRows = intRows + 1 Response.Write("<td>") %> <center> <img src="shotdev/<%=objRec.Fields("Picture").Value%>"><br> <%=objRec.Fields("GalleryName").Value%> <br> </center> <% Response.Write("</td>") If intRows Mod 2 = 0 Then Response.Write("</tr>") End If objRec.MoveNext Wend Response.Write("</tr></table>") objRec.Close() Conn.Close() Set objRec = Nothing Set Conn = Nothing %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_mysql_column.asp
Screenshot