Forums

This topic is locked

help with this please

Posted 13 Mar 2005 09:24:00
1
has voted
13 Mar 2005 09:24:00 Jaime Romo posted:
hello there i hope u guys understand me on what i whant to do....
i have a sql db with this table
dbBusiness
the fields are [id, title, image, category, idSecction, link]
and im sorting the business in categories, from A to Z so when u clic on the a it appears all the categories that begin with A
the problem comes here i whant to diplay how many records has each category so i did this
<font color=red>
This is the recordset that displayes the categories:</font id=red>
<pre id=code><font face=courier size=2 id=code>&lt;%
Dim negocios__MMColParam
negocios__MMColParam = "1"
If (Request.QueryString("anuncio" &lt;&gt; "" Then
negocios__MMColParam = Request.QueryString("anuncio"
End If
Dim negocios
Dim negocios_numRows
Set negocios = Server.CreateObject("ADODB.Recordset"
negocios.ActiveConnection = MM_smaDB_STRING
negocios.Source = "SELECT * FROM vohyndra.smaDBnegociosCategorias WHERE negocios LIKE '" + Replace(negocios__MMColParam, "'", "''" + "%'"
negocios.CursorType = 0
negocios.CursorLocation = 2
negocios.LockType = 1
negocios.Open()
negocios_numRows = 0
%&gt;
AND this is the recordset that displays the total of records in each categories
&lt;%
Dim conteo__MMColParam
conteo__MMColParam = "0"
If (Request.QueryString("anuncio" &lt;&gt; "" Then
conteo__MMColParam = Request.QueryString("anuncio"
End If

Dim conteo
Dim conteo_numRows
Set conteo = Server.CreateObject("ADODB.Recordset"
conteo.ActiveConnection = MM_smaDB_STRING
conteo.Source = "SELECT COUNT (*) as totales FROM smaDBnegocios WHERE categoria LIKE '" + Replace(conteo__MMColParam, "'", "''" + "%' AND controlador = '1' GROUP BY categoria"
conteo.CursorType = 0
conteo.CursorLocation = 2
conteo.LockType = 1
conteo.Open()
conteo_numRows = 0
%&gt;</font id=code></pre id=code>


THE PROBLEM IS THAT IT TAKES THE FIRST COUNT O CATEGORIES AND IT PUT'S IT TO ALL OF THEM SO ALL THE CATEGORIES HAS TEH SAME VALUE.... HOWCAN I FIX IT

THANKS FOR YOUR HELP

Visit my home page
www.cancuncoral.com

Reply to this topic