Jump to content

PHP and AJAX MySQL Database Problem


maweber98
 Share

Recommended Posts

I have followed the example at w3schools to use AJAX to dynamically connect to a mysql database using a PHP script and bring the content back to the page. I have everything set up in the example link below. My problem is that I want to do two seperate queries on a form and bring the information back to the page. The queries both work but the placement of the information is giving me problems. It places the results of both queries in the same <div> container. Even though the <div> containers have different ID's. http://www.coastalpet.com/testing/product_admin_st4.phpDoes anyone have any suggestions on how to get the results in the right spots on the page. Thank you!

Link to comment
Share on other sites

It's because there are two functions with the name "stateChanged" - one is in the selectcolor.js and the other is in the selectdescription.js. When you load the page, you have selectcolor.js loaded first, which loads its stateChanged function into memory. Then, after selectcolor.js has been loaded, the browser fetches selectdescription.js which loads its stateChanged function into memory - overwriting the selectcolor.js stateChanged function.The simplest solution would be to come up with two different names - perhaps colorStateChanged and descriptionStateChanged.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...