ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old November 10th, 2004, 08:26 AM
myhomie myhomie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 20 myhomie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow Adding a comment and displaying certain ones

I'm trying to add an add comment feature and the user can either let the comment be seen by people in her graduationYear, students, Alumnae, or everyone.
So I need to insert/update the table (either if the user is an Alumna or student) with the comment and the type (who will be seeing it). However, with the code so far I am getting an error. Here is what I have on the form page with the add comment feature: (The error message is listed at the bottom- which I get before I even add a comment- not pulling up right).
-to view the ones for everyone

SELECT COMMENTS, TYPE FROM S, A
WHERE TYPE = Everyone

<cfoutput query="Comments">
#comments#
</cfoutput>

-to view comments for alumna only -their status is 1

<cfif Member.alumStatus EQ 1>
SELECT COMMENTS, TYPE FROM A
WHERE TYPE = ALUMNAE

<cfoutput query="Comments">
#comments#
</cfoutput>

-output student Announcements
<cfelse>
SELECT COMMENTS, TYPE FROM S
WHERE TYPE = STUDENT
<cfoutput query="Comments">
#comments#
</cfoutput>
</cfif>

-look at your class comments (gradYear)
if you are an alumna
<cfif Member.alumStatus EQ 1>
SELECT COMMENTS, TYPE FROM A
WHERE TYPE = CLASS AND WHERE GRADYEAR= '#gradYear#'
<cfoutput query="Comments">
#comments#
</cfoutput>
<cfelse>
-you are an student
SELECT COMMENTS, TYPE FROM S
WHERE TYPE = CLASS AND WHERE GRADYEAR= '#gradYear#'
<cfoutput query="Comments">
#comments#
</cfoutput>
</cfif>

Then on the page that validates the comments, I need to update the tables:
- the the memeber is an alumnae
<cfif form.Status EQ 1>

update A
Set comment = '#form.comment#',
TYPE = '#form.type#'
WHERE username = '#form.Edituser#'

</cfquery>

-the member is a student
<cfelse>

update S
Set comment = '#form.comment#',
TYPE = '#form.type#'
WHERE username = '#form.Edituser#'
</cfquery>
</cfif>

The error message when trying to go to the home page (with the add comment feature is):

ODBC Error Code = S1000 (General error)


[Microsoft][ODBC Microsoft Access Driver] The specified field 'COMMENTS' could refer to more than one table listed in the FROM clause of your SQL statement.


SQL = "SELECT COMMENTS, TYPE FROM S, A WHERE TYPE = Everyone"



Thanks a bunch! any help would be appreciated!

Reply With Quote
  #2  
Old November 10th, 2004, 08:57 AM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,316 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 16 h 48 m 13 sec
Reputation Power: 22
Send a message via AIM to bocmaxima
SQL is trying to tell you that you have multiple tables with a field called "COMMENTS" so you need to tell it exactly which table/field you want. This is probably the problem query:
SELECT COMMENTS, TYPE FROM S, A
WHERE TYPE = Everyone

You need to change it to this:
SELECT S.COMMENTS, TYPE FROM S, A
WHERE TYPE = Everyone

Hope that helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Adding a comment and displaying certain ones


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway