Print Page | Close Window

How many times?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1837
Printed Date: 29 March 2026 at 5:16am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: How many times?
Posted By: Mart
Subject: How many times?
Date Posted: 15 April 2003 at 2:24pm

Hi everyone, thanks for all your help in the past. Anyway I am making a MP3 database and tehy are split up into genres, which can be selected from the side. I need to get it to tell me how many times the genre is rock for instance, but how do i do it?

 

Thanks inadvance, Martin.




Replies:
Posted By: eagle00789
Date Posted: 15 April 2003 at 3:13pm
so what you basicly want to do is count how many times a genre is selected?

-------------
Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here


Posted By: glypher
Date Posted: 15 April 2003 at 3:14pm

decyphering your post i think this is what you're looking for:

select count(*) from tbl_x
where fld_genre like 'rock'

to expand that a bit:

select genus, count(*) from tbl_x
where fld_genre like 'rock'
group by fld_genre
order by count(*)



-------------
glypher said so.

http://www.gainesvillebands.com - GainesvilleBands.com


Posted By: glypher
Date Posted: 15 April 2003 at 3:19pm

eagle, now that i'm rereading it /again/ you might be onto what he wanted.

martin: if that is actually what you wanted, you'd have to put a catcher on the directed page (the one the person is going to) that increments a counter into a database table.

SELECTION PAGE:
grab info out of database on how many times the genre's were selected.
Select ROCK ->

RESULT PAGE:
grab genre selected,
update database.
continue with page.

make sence?  no? well re-read it. like i had to do.



-------------
glypher said so.

http://www.gainesvillebands.com - GainesvilleBands.com


Posted By: Mart
Date Posted: 16 April 2003 at 5:56am
Tell you what, go on http://www.minac.tk - http://www.minac.tk  and you will see what i mean, just incase you don't where it says Drum and Bass at the side I want it to say something like Drum and Bass (** files) how do I do it?


Posted By: ultramods
Date Posted: 16 April 2003 at 6:26am

You could try: 

sql="select count(*) as numberOfGenre from MP3Table where
genre=' " & genre & " ' "

response.write("Drum & Bass " & numberOfGenre )



Posted By: Mart
Date Posted: 16 April 2003 at 9:29am

Its proabably just me (I havent much experiance with databases) but I cant get that last script to work!

Its in tblMP3 is this right:

sql="select count(*) as numberOfGenre from tblMP3.genre where
genre=' " & genre & " ' "



Posted By: michael
Date Posted: 16 April 2003 at 10:12am

sql="select count(*) as numberOfGenre from tblMP3 where
genre=' " & genre & " ' "

where do you get the .genre part from?



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Mart
Date Posted: 16 April 2003 at 11:31am

I thought you have to select the column thing to get it from

?Im confused?



Posted By: michael
Date Posted: 16 April 2003 at 11:37am
the syntax is :
select count(*) as VirtualColumname from tablename where Columname = Value

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Mart
Date Posted: 16 April 2003 at 11:37am

Right I used this code:

strSql="select count(*) as numberOfGenre from tblMP3 where genre=' " & genre & " ' "

I set genre to dnb (Dim genre, genre = "dnb")

And when I put the  

response.write("Drum & Bass " & numberOfGenre ) bit in it just writes Drum & Bass (nothing else)

What am i doing wrong



Posted By: michael
Date Posted: 16 April 2003 at 12:49pm

response.write("Drum & Bass " & rs("numberOfGenre") )
where rs is your recordset. Look through the database tutorials on this site to get some feel for how to do it. You will find it much easier to understand database queries after that. Just a suggestion.



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Mart
Date Posted: 16 April 2003 at 1:19pm

Thanks michael, it works now. That code wasn't very clear for me because I am not very experianced with databases.

Thanks, Martin




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net