|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
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! |
|
#2
|
||||
|
||||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Adding a comment and displaying certain ones |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|