Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Database entrys with cfm 1

Status
Not open for further replies.

noellees1

Programmer
Feb 2, 2004
383
GB
Hi, ive setup a database with a datasource etc i want it so when people enter into that database on a main page you can make a script which counts the ammount of users registerd. getting me so far?

all i can say is im quite new to cfm and just want a way to count records in a database so that itle display as a number how many users have been made.
an examble would be brilliant.
thanks
N lees

Hope this helps,
 
I am just a newbie and I am sure someone here can give you better advice, but this should work.

Code:
<cfquery name="younameit" datasource="yourdatasource">
Select *
From your_table
</cfquery>

<cfset totalusers="younameit.recordcount">

Total Users:<cfoutput>#totalusers#</cfoutput>
 
Try this:
Code:
<cfquery name="younameit" datasource="yourdatasource">
Select Count(*) AS Records
From your_table
</cfquery>

<cfoutput query="younameit"> There are #Records# records in the database</cfoutput>




Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top