Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with jQuery and AJAX process to load data to MySQL

Posted on 2011-09-28
4
Medium Priority
?
343 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
  • 2
4 Comments
 
LVL 83

Accepted Solution

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

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

886 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