Solved

Help with jQuery and AJAX process to load data to MySQL

Posted on 2011-09-28
4
335 Views
Last Modified: 2012-05-12
I am wanting to use jquery/ajax to load data to mysql. Below is the HTML and the php script that I am using. When I run this program the MySql db is NOT updated. Would someone please review the code and offer any suggestions as to why this may not be working? This is my first attempt at jquery/ajax so the error may be a simple one but it has me stumped. Thanks.

 ee.txt
0
Comment
Question by:kbios
[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
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36717078
replace : data: "item="+citem,
by : data: "citem="+citem,
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36717093
"replace" :
mysql_query("INSERT INTO itemdtl (ukey, item) VALUES ("XXXX10000", '$item')");

Open in new window

by :
   $result = mysql_query("INSERT INTO itemdtl (ukey, item) VALUES ("XXXX10000", '$item')");
if (!$result) {
    die('Invalid query: ' . mysql_error());
}

Open in new window

0
 
LVL 2

Expert Comment

by:Robert Silver
ID: 36717194
Your HTML is missing a HEADER and BODY to start with You may find that an OnLoad javascript
may be helpful in setting things up as well.  e.g <BODY onLoad="javascript:myFunction();">


If I were you I would start with a simple connection test in PHP
maybe write it to a file or the screen using typical submit action code

the file is as simple as
$fp1=fopen("path2debgfile.txt", "a");
fwrite($fp1, "what I want to verify:" .  (string)  $valueFromDatabase );
fclose($fp1);

I find that really helps when debugging complex web apps
There are also debuggers you can use as well

I hope thsa helped.
0
 

Author Closing Comment

by:kbios
ID: 36717264
You're terrefic!  Thank you. I can't believe I was THAT close but hey that's why you're the expert! Thanks again.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

623 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