Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2810
  • Last Modified:

RowCount

Does mysql support rowcount when using it in asp.I am trying to display every other reocrd displayed in my asp page indented.
0
thenone
Asked:
thenone
5 Solutions
 
BogoJokerCommented:
Hi thenone,

Since you have not yet gotten a comment I'll try to help you out.
You could add an extra field COUNT(column_name) as num_rows, so it would look like:
SELECT *, COUNT(column_name) as num_rows, FROM table

Joe P
0
 
thenoneAuthor Commented:
you have tried to help me with this before I belive and I still can't get it to work because I am not sure if mysql supports it this way.

rowcount = rowcount + 1

if rowcount = 2 then
rowcount = 0

if rowcount = 0 then
style = text:indent 10 px
else
style = text:indent 0px
end if

Then I have my for loop in my table

0
 
BogoJokerCommented:
In php, after the query I would just do:
$numOfRows =  mysql_num_rows();
Is there such a function in ASP?  To count the number of rows?
This pulls the responsibility away from mysql and into ASP, is that okay?

Joe P
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
ikeworkCommented:
hi thenone,

i guess you use an ado-recordset in your asp, to retreive the records, so after Recordset.Open you can retreive the recordcount with Recordset.RecordCount:

Dim rst as new ADODB.Recordset
Dim count as Long

rst.Open "Select ..."
count = rst.RecordCount


hope it helps :)
ike
0
 
Austin_HastingsCommented:
select @rnum:=(@rnum+1)%2 AS parity, * from table
0
 
pradapkumarCommented:
you can do it in two steps. LIke

first execute this querry to get the no of rows

SELECT COUNT(*) as num_rows, FROM table WHERE<your Condition>

then execute ur querry normally

SELECT *  FROM table WHERE<your Condition>

;-)

Pradap
0
 
ikeworkCommented:
hey guys, we dont need to reinvent the wheel .. ado-recordset-object has a method for that ...

ike
0
 
BogoJokerCommented:
And although its true pradapkumar, executing two querries would probably not be the best way to do this.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now