Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with jQuery and AJAX process to load data to MySQL

Posted on 2011-09-28
4
Medium Priority
?
340 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
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…

722 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