Results 1 to 2 of 2
  1. #1
    Abina's Avatar
    Abina is offline Master
    Join Date
    Dec 2009
    Location
    United States
    Posts
    1,073
    Thanks
    1
    Thanked 6 Times in 4 Posts
    Feedback Score
    0

    Default How to check if a guery returns something

    I am querying a database and want to know if a row is returned before I print anything, how do I do this in cold fusion?

    thanks

  2. #2
    numberone's Avatar
    numberone is offline Senior
    Join Date
    Jan 2010
    Posts
    623
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    Generally you use the query's "recordCount" variable.

    <cfquery name="yourQueryName" datasource="...">
    SELECT Something FROM SomeTable
    </cfquery>

    <cfif yourQueryName.recordCount GT 0>
    query contains (1) or more records
    <cfelse>
    query contains (0) records
    </cfif>

Similar Threads

  1. Replies: 1
    Last Post: 02-02-2010, 11:14 AM
  2. Spell Check Your Website Content
    By mastermind in forum Web Development - Programming & Coding
    Replies: 4
    Last Post: 06-30-2009, 02:09 AM
  3. $360 billion check!
    By webdigo in forum General Talk
    Replies: 8
    Last Post: 12-13-2008, 11:41 AM
  4. New Tool: Check your page rank in datacenters
    By rapidvectorseo in forum Search Engine Optimization
    Replies: 8
    Last Post: 12-10-2008, 12:07 AM
  5. Replies: 9
    Last Post: 10-23-2008, 10:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS