?
Solved

Coldfusion Bugs Won't Insert all fields

Posted on 2003-03-01
9
Medium Priority
?
194 Views
Last Modified: 2013-12-16
I have a simple cfform which uses cfinsert to write to MYSQL.  Too bad it's not as simple as you would think.  Sometimes the all data is written to the DB, sometimes it's not.  There are no errors. All I am attempting to INSERT is simple text. Why would it work sometimes, and not others?
0
Comment
Question by:craigneil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 
LVL 16

Expert Comment

by:twalgrave
ID: 8052460
You might try posting the code that shows the DB inserts.  

Frequently inserts do not happen because of:
1) errors, you indicate there are none
2) permissions, but if they sometimes work to the same table, then this probably isn't your issue
3) Failure to issue the update statements required if you are using them
4) Failure to commit a transaction
5) You are never actually issuing the command (the code never falls into the statement because it does not meet conditional criteria.
0
 

Author Comment

by:craigneil
ID: 8054815
Form:
<cfform action="process2.cfm">
                                            <div class= "req">*First Name:*</div>
                            <td bgcolor="638ACE">
                              <cfinput name="firstname" size="15" maxlength="50" required="yes" message="!You Must Fill in Your FIRST NAME!">
                            </td>
                            <td bgcolor="638ACE"><div class="req">*Last Name:*</div>
                            </td>
                            <td bgcolor="638ACE"><cfinput name="lastname" size="15" maxlength="50" required="yes" message="!You Must Fill in Your LAST NAME!">
                            </td>
                          <tr>
                            <td>
                              <div class="re">Co - First Name:</div>
                            </td>
                            <td><cfinput name="cofirstname" size="15" maxlength="50">
                            </td>
                            <td><div class="re">Co - Last Name:</div>
                            </td>
                            <td><cfinput name="colastname" size="15" maxlength="50">
                            </td>
                          </tr>
                          <tr>
                            <td bgcolor="638ACE">
                              <div class="req">*Day Phone:*</div>
                            </td>
                            <td bgcolor="638ACE"><cfinput name="dayphone" size="15" maxlength="20" required="yes" message="!You must fill in your DAYTIME PHONE NUMBER!">
                            </td>
                            <td bgcolor="638ACE"><div class="re">Evening Phone:</div>
                            </td>
                            <td bgcolor="638ACE"><cfinput name="eveningphone" size="15" maxlength="20">
                            </td>
                          </tr>
                          <tr>
                            <td>
                              <div class="re">Best Time to Call:</div>
                            </td>
                            <td>
                              <cfinput type="radio" name="besttime" value="day">
            Day
            <cfinput type="radio" name="besttime" value="evening">
            Evening </td>
                            <td><div class="re">Email Address:</div>
                            </td>
                            <td>
                              <cfinput name="email" size="15" maxlength="75">
                            </td>
                          </tr>
                          <tr>
                            <td bgcolor="638ACE">
                              <div class="req">*Street Address:*</div>
                            </td>
                            <td bgcolor="638ACE"><cfinput name="address" size="15" maxlength="100" required="yes" message="!You must fill in your STREET ADDRESS!">
                            </td>
                            <td bgcolor="638ACE"><div class="req">*City:*</div>
                            </td>
                            <td bgcolor="638ACE"><cfinput name="city" size="15" maxlength="50" required="yes" message="!You must fill in your CITY!">
                            </td>
                          </tr>
                          <tr>
                            <td>
                             
      <div class="req"></div>
    </td>
    <td>&nbsp; </td>
    <td>
      <div class="req">*Zip Code:*</div>
    </td>
    <td>
      <cfinput name="zipcode" size="10" maxlength="10" required="yes" message="!You must fill in your ZIPCODE!">
    </td>
  </tr>
  <tr>
    <td bgcolor="638ACE">
      <div class="req"></div>
    </td>
    <td bgcolor="638ACE">&nbsp;</td>
    <td bgcolor="638ACE">&nbsp;</td>
    <td bgcolor="638ACE">&nbsp;</td>
  </tr>
  <tr>
    <td>
      <div class="req"></div>
    </td>
    <td>&nbsp;</td>
    <td>&nbsp; </td>
  </tr>
  <tr>
    <td bgcolor="638ACE">
      <div class="req"></div>
    </td>
    <td bgcolor="638ACE">&nbsp;</td>
    <td bgcolor="638ACE">
      <div class="req"></div>
    </td>
  </tr>
  <tr>
    <td bgcolor="638ACE">&nbsp;</td>
    <td bgcolor="638ACE">&nbsp;</td>
  </tr>
  <tr>
    <td>
      <div class="req">Annual Income: </div>
    </td>
    <td>
      <cfinput name="income"  size="15">
    </td>
    <td>
   
    </td>
    <td>
     
    </td>
  </tr>
  <tr>
    <td colspan="4" bgcolor="638ACE">
      <div align="center"><font color="003366" size="2">
        <input type="submit" value="Submit">
        <br>
        <b><font color="#FFFF00">*Required Fields Are Marked in Yellow*</font></b></font></div>
</cfform>


Process2.cfm:
<cfset Form.adddate = (now())>
<cfset Form.source = (1)>
<cfinsert datasource="TESTING" tablename="application">
<cflocation url="thank_you.html">
0
 
LVL 16

Accepted Solution

by:
twalgrave earned 225 total points
ID: 8059226
I'm not a Coldfusion expert, but you might find your answer here (it looks very similar to what you are doing):
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20384232.html
0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 

Author Comment

by:craigneil
ID: 8060678
CFINSERT is too fickle to allow it to determine the form fields without specifying any.  I tried this code, and it works much better, with zero data loss:

<cfinsert datasource="#DATASOURCE#" tablename="application" formfields="#form.fieldnames#, adddate, source">

0
 
LVL 16

Expert Comment

by:twalgrave
ID: 8061469
That's just what is said in the link I provided.  Can you accept my answer then?  You do that by going to the link to the right of my comment named "Accept Comment as Answer" and assigning an appropriate grade.  Thanks.
0
 

Author Comment

by:craigneil
ID: 8061533
I didn't use your info to get my answer. Do you still think I should give you the points?
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 8061617
That's entirely up to you my friend.  All I really care about is that this question, since it now has an answer, is finalized one way or the other.  The other way (other than awarding the points to me) is to post a zero-point question in the community support topic area (found on the left of the page or by clicking here: http://www.experts-exchange.com/Community_Support/ ) asking for a refund of the points on this question.  Make sure to give the question number (from this URL) or the URL itself: http://www.experts-exchange.com/Programming/Q_20534855.html in the comment section.  Note:  This question should be PAQ'd and not deleted because it does have value since the solution is posted.

Actually, there's a 3rd option (and I don't want this to sound like I'm looking for points, because I really do not care one way or the other).  That option is to post in community support the way mentioned above.  Ask for the question points to be reduced and then accept my answer.

Now I think I've exhausted all the possible options.  I hope this helps you make a decision in how to finalize this question.

Truly, honestly, I would not have any hard feelings if you asked for all your points back.
0
 

Expert Comment

by:CleanupPing
ID: 9447422
craigneil:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question