Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Total Noob wanting some help

New Here ,
Apr 24, 2008 Apr 24, 2008
Hi guys I just got new job and they use CF over here. My first small project is thowing me for a loop just because I've never really worked databases before. I'm looking for some starting help. We have this intranet site that everyone here uses to place orders and stuff, they all use bunches of databases. And what my boss is wanting me to do is find a way to put a count of all the items in a database that match a certian criteria on the main page. So what I need is a way to count database items. Help would be helpful. Like I said I'm a total n00b and forgive me if you can't make heads or tails of this. I'd be glad to explain more in depth for help. Thanks guys

Kevin
TOPICS
Getting started
273
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 25, 2008 Apr 25, 2008
Well, let says that you want to get a count of everything in your ITEMS table that has a QUANTITY of at least 3 and a PRICE of greater than $5.00 (assuming that QUANTITY and PRICE and columns within the ITEM table)

A real simple way of handling this app would be to first do the query and then out put the result. Your entire application would be:

<cfquery name="qGetItemCount" datasource="datasourceName">
SELECT Count(*) AS itemCount
FROM items
WHERE quantity >= 3
AND price > 5
</cfquery>

<cfoutput>#qGetItemCount.itemCount#</cfoutput>

And that is it. It only gets more complicated from there, and you need to strongly consider some learning resources if you want to excel at ColdFusion. It is an easy language to learn and use, but, like any other language, it should not be fuddled through.

Note: You'll need to get your datasourceName from your administrator.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 25, 2008 Apr 25, 2008
LATEST
In addition, if you will be working with databases you will need to learn SQL. SQL is separate from ColdFusion. It is the language used to communicate with databases, regardless of what web application you are using. There are some syntax differences, depending on which database type you are using. However, the basic language structure is the same across most databases.

You can find a good introductory SQL tutorial here
http://www.w3schools.com/sql/default.asp
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources