User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 392,001 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,197 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 10241 | Replies: 1
Reply
Join Date: May 2004
Posts: 1
Reputation: SD2001 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SD2001 SD2001 is offline Offline
Newbie Poster

MySQL RecordCount Problems

  #1  
May 2nd, 2004
Having built a work around for the counting feature not working, in any of the normal ways Ihave the following problem.

This works perfectly:

<%

RSPage = TRIM(Request.QueryString("page"))

If Len(RSPage) = 0 Then RSPage = 1

Max = 10

If RSPage = 1 Then Offset = 0
If RSPage > 1 Then Offset = (RSPage-1) * Max

Set
CConn = Server.CreateObject("ADODB.Connection")
CConn.Open strADO
Set CRs = Server.CreateObject("ADODB.RecordSet")

CRs.Open "SELECT COUNT(*) AS PAGECOUNT FROM tblsearch WHERE Active=-1 AND Reference=" & strRefLink, CConn

TotalRecords = CRs("PAGECOUNT")


If (Round((TotalRecords/Max))) = Round((TotalRecords/Max),2) Then
TotalPages = Round((TotalRecords/Max),2)
Else
TotalPages = Round((TotalRecords/Max)+1)
End If

If Not CInt(TotalPages) = CInt(RSPage) Then
If TotalRecords < Max Then
PageSwitch = False
Else

PageSwitch = True
End
If
End If

CRs.close
CConn
.close
%>

I also need it to work with the following SQL but have failed in all attempts so far.

"SELECT *, MATCH (url,description,name) AGAINST ('" & Search & "' IN BOOLEAN MODE) AS score FROM tblsearch WHERE Active=-1 AND MATCH (url,description,name) AGAINST ('" & Search & "' IN BOOLEAN MODE) ORDER BY name ASC LIMIT " & Offset & "," & Max

The MATCH command seems to be causing a problem when combined with the COUNT(*) feature,


The String above works fine on its own, but not with COUNT(*).


Can anyone help? :rolleyes:


Anthony

AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Location: Barletta
Posts: 1
Reputation: bronko85 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bronko85's Avatar
bronko85 bronko85 is offline Offline
Newbie Poster

Re: MySQL RecordCount Problems

  #2  
Sep 6th, 2006
The COUNT(*) method was used only with GROUP BY statement.
So, if you have some colums in SELECT statement YOU MUST insert also a GROUP BY statement in your sql string.

I've solved this problem, deleting all columns in select statement [inserting only count(*)], and manteining the other part the same.

Bye.

PS. I'm italian and i've not a lot of experience with english language.
Studing it its different to write it.
FILANNINO MICHELE
-----------------------------
Studente presso il Dipartimento di
Informatica e Tecnologie per la produzione del software.
Bari (IT)
-----------------------------
http://www.filanninomichele.com/
info@filanninomichele.com
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 10:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC