Skip to content
Advertisement

jQuery calls a PHP file to get data from mysql database?

Ok so I have found a number of tutorials online and have followed each of them step by step. My problem is that I know javascript/jQuery much better than I know PHP and I cannot figure out how to even debug what is going wrong in that section. Basically I have a bunch of buttons and a from and when a button is pressed it determines what the default values are in the form.

jQuery Side

JavaScript

PHP side

JavaScript

Any ideas why sr is not getting set?

Am I way off base?

I will also shamelessly note that I do not know what $user and $pass should be set to. I cannot find that explained anywhere

Thanks in advance!

EDIT: I followed most of the directions below and now when I run

JavaScript

it says “No database selected.” Also, I dont have access to our original MS Access file now (one of my team members has it) but once I get it I will make all the headers into one word headers. This is our first job with web programming/database management so we are constantly learning.

Advertisement

Answer

$user and $pass should be set to your MySql User’s username and password.

I’d use something like this:

JS

JavaScript

PHP:

JavaScript

As another user said, you should try renaming your database fields without spaces so part parameters => part_parameters, Part Number => part_number.

If you’re still having trouble then (as long as it’s not a production server) put this at the top of your php file:

JavaScript

This will output any errors and should help you work out what’s going wrong.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement