Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Count problem


Count problem

Reply
  #1 (permalink)  
Old 05-10-04, 09:19 AM
kasic's Avatar
kasic kasic is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Serbia
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Count problem

hi. I have some problem that makes me freak. Im building some web application that displays some programming languages in this order on the screen

php | asp | visual basic
.net | perl |

this is all located in table (like main page on hotscripts). if I add some record in database, table above will look like this

php | asp | visual basic
.net | perl | new_record

code for this
<%
While(dr.Read())
%>
<tr>
<td><%Response.Write(dr.Item("fieldname"))%></td>
<td><%If dr.Read() Then Response.Write(dr.Item("fieldname"))%></td>
<td><%If dr.Read() Then Response.Write(dr.Item("fieldname"))%></td>
</tr>
<%
End While
%>

this algorithm works great, but with small problem displaying last record if it is 15th of them, accually algorithm displays picture but not the text (becouse there are no 15th record), but the picture is present...

this isn't the main problem

the main problem

in this table I want (just like on hotscripts) to have in brackets how many posts, or what ever, I have for every program language and I've created SQL query just like this

SELECT Count(*) As num FROM cat WHERE catID=id

id is field from other table where is listed all program languages that needs to be displayed and problem starts here...

when I execute query I get the result like this

PHP (3) | ASP (3) | Visual Basic (3)

and the others are just 0 (zero)... in table that is stored posts for all languages exists just three with catID of 1 which indicates that this is PHP, but like you see this doesen't work...

my question after this very long story is how can I calculate how many posts are in each program laguage and to display it on the page?

sorry if I was boring with this, but this is what I need now and it's very important and I beg you to solve this as soon as you can

I need to inform you that connection to database is ODBCConnection for mySQL database with Driver 3.51 or whatever here goes, ofcourse it is word about ASP.NET thanks fellas for all your help...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-20-04, 01:23 AM
thuenb thuenb is offline
Newbie Coder
 
Join Date: Oct 2004
Location: MI
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
If I am understanding you correctly?? How about...

Code:
SELECT Count(*) As num FROM cat WHERE catID=id and type ="PHP"

'obviously you would change the "type" to represent a field in your DB that informed you of the particular catagory it was in

SELECT Count(*) As num FROM cat WHERE catID=id and type ="Asp.net"
'etc
Does that help?
__________________
Best Regards,
Brian Thuen
http://www.AdvisedSolutions.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie found a solution to a date problem. mickey_kamer Perl 4 05-09-07 06:54 AM
Include Problem DAL Perl 3 11-20-04 08:45 AM
problem with next and previous links abtimoteo Perl 0 01-05-04 02:13 PM
Post count, why? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 7 10-06-03 04:29 PM
jpGraph axis labeling problem Squeezer PHP 2 08-20-03 08:53 AM


All times are GMT -5. The time now is 10:46 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.