Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Coldfusion Bugs Won't Insert all fields

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
craigneil
Asked:
craigneil
  • 4
  • 3
1 Solution
 
twalgraveCommented:
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
 
craigneilAuthor Commented:
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
 
twalgraveCommented:
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
Technology Partners: 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!

 
craigneilAuthor Commented:
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
 
twalgraveCommented:
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
 
craigneilAuthor Commented:
I didn't use your info to get my answer. Do you still think I should give you the points?
0
 
twalgraveCommented:
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
 
CleanupPingCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now