si totalmente deacuerdo de que asi queda bien pero la idea es que la lista de las categorias (que aun no aparece) este en una columna de mi tabla y los productos de esa categoria esten en la otra columna de esta pues... si asi tambien lo intente pero no es lo que hando buscando.... mira para que te hagas una idea de lo que quiero ejecuta este codigo en tu pc:
catalogo.asp
Código:
<% @ language="VBscript" %>
<% Option Explicit %>
<html>
<head>
<title>Catálogo on-line</title>
</head>
<body>
<%
'Declarar Variables
Dim Conn
Dim categorias_sql
Dim productos_sql
Dim rs
Dim categoria
'Rescate de valores por URL
categoria = Request.Querystring("id")
'Se pone una condición
if categoria = "" Then
categoria = 1
end if
'Instanciar y abrir la conección
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("catalogo.mdb"))
'Creación de la sentencia SQL correspondiente
categorias_sql="Select * From categorias"
'Creación del Recordset
set rs = CreateObject("ADODB.Recordset")
'Apertura del Recordset
rs.Open categorias_Sql, Conn
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">Categorías</td>
</tr>
<%
Do While Not rs.Eof
%>
<tr>
<td width="100%"><a href="catalogo.asp?id=<% = rs("id_categoria") %>"><% = rs("nombre_categoria") %></a>(<% = rs("total_productos") %>)</td>
</tr>
<%
rs.MoveNext
Loop
rs.close
%>
</table>
</td>
<td width="80%">
<table border="1" width="80%" cellspacing="0" cellpadding="2">
<tr>
<td width="9%"> </td>
<td width="25%"> Marca</td>
<td width="50%"> Modelo</td>
<td width="16%" align="right">Precio</td>
</tr>
</table>
<br>
<%
'Creación de la sentencia SQL correspondiente
productos_sql = "Select * From productos Where categoria = " & categoria & ""
'Apertura dle Rescordset
rs.Open productos_sql, Conn
Do While Not rs.Eof
%>
<table border="1" width="80%" cellspacing="0" cellpadding="2">
<tr>
<td width="9%" align="center"><a href="verdetalle.asp?id=<% = rs("id_producto") %>"><img src="<% = rs("imagen") %>" width="50" height="50" border="0"></a></td>
<td width="25%"> <a href="verdetalle.asp?id=<% = rs("id_producto") %>"><% = rs("marca") %></a></td>
<td width="50%"> <a href="verdetalle.asp?id=<% = rs("id_producto") %>"><% = rs("modelo") %></a></td>
<td width="16%" align="right">$<% = rs("precio") %></td>
</tr>
</table>
<br>
<%
rs.MoveNext
Loop
set rs = nothing
Conn.close
set Conn=nothing
%>
</td>
</tr>
</table>
</body>
</html>
verdetalle.asp
Código:
<% @ language="VBscript" %>
<% Option Explicit %>
<html>
<head>
<title>Catálogo on-line</title>
<SCRIPT>
<!--
function displayWindow(url, width, height)
{
var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,status=no' );
Win.resizeTo(width,height)
Win.focus();
}
//-->
</SCRIPT>
</head>
<body>
<%
'Declarar Variables
Dim Conn
Dim categorias_sql
Dim productos_sql
Dim rs
Dim id
'Rescate de valores por URL
id = Request.Querystring("id")
'Se pone una condición
if id = "" Then
id = 1
end if
'Instanciar y abrir la conección
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("catalogo.mdb"))
'Creación de la sentencia SQL correspondiente
categorias_sql="Select * From categorias"
'Creación del Recordset
set rs = CreateObject("ADODB.Recordset")
'Apertura del Recordset
rs.Open categorias_Sql, Conn
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">Categorías</td>
</tr>
<%
Do While Not rs.Eof
%>
<tr>
<td width="100%"><a href="catalogo.asp?id=<% = rs("id_categoria") %>"><% = rs("nombre_categoria") %></a>(<% = rs("total_productos") %>)</td>
</tr>
<%
rs.MoveNext
Loop
rs.close
%>
</table>
</td>
<td width="80%">
<%
'Creación de la sentencia SQL correspondiente
productos_sql = "Select * From productos Where id_producto = " & id & ""
'Apertura dle Rescordset
rs.Open productos_sql, Conn
%>
<table border="0" width="80%" cellspacing="0" cellpadding="0">
<tr>
<td width="90%"><% = rs("marca") %>: <% = rs("modelo") %></td>
<td width="10%">$<% = rs("precio") %></td>
</tr>
<tr>
<td width="90%"><% = rs("descripcion") %></td>
<td width="10%"><a href="javascript:displayWindow('imagenes.asp?id=<% = rs("id_producto") %>',<% = rs("Ancho")+8 %>,<% = rs("Alto")+27 %>)"><img src="<% = rs("imagen") %>" alt="Pulsa para ampliar" width="50" height="50" border="0"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
imagenes.asp
Código:
<html>
<head>
<title>Ver una imagen de la galeria</title>
</head>
<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
<%
Const DB = "bd/metallica.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("catalogo.mdb"))
strSQL = "Select * from productos Where id_producto = " & Request.QueryString("id")
Set RS = Conn.Execute(strSQL)
Response.Write "<img src=""" & rs("imagen") & """ border=""0"" width=""" & rs("ancho") & """ height=""" & rs("alto") & """>"
Conn.Close
Set Conn = Nothing
%>
</body>
</html>
y la tabla tiene los siguientes campos:
tabla categorias
id_categoria (autonumerico)
nombre_categoria (texto)
total_productos (numerico)
tabla productos
id_producto (autonumerico)
categoria (numerico)
imagen (texto)
ancho (numerico)
alto (numerico)
marca (texto)
modelo (texto)
descripcion (texto)
precio (texto)
ahi tu le asignas los valores que quieras a eso
Bueno gacias por tu paciencia y ayuda amigo.... saludos