mlseim Posted March 19, 2013 Posted March 19, 2013 I'm getting the message below on a PHP script I'm using. It happens in a part where I'm using an AJAX chainselect drop-down menu. I can't figure out why this is showing up and how to fix this. What is really frustrating is that is doesn't happen all the time. Some selections work and some don't. Warning: mysql_query() [function.mysql-query]: Access denied for user 'leamsp'@'localhost' (using password: NO) in /home1/leamsp/public_html/prospect/func.php on line 28 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home1/leamsp/public_html/prospect/func.php on line 28Access denied for user 'leamsp'@'localhost' (using password: NO) Here is a test page ... http://leamspworldwide.heliohost.org/prospect/
Shinryuu Posted March 19, 2013 Posted March 19, 2013 Just to make sure, did you fix it already? Your link works and viewing func.php doesn't produce any errors. 1
Tjoene Posted March 19, 2013 Posted March 19, 2013 Perhaps you are seeing a cached version of your site.Have you tried to clear your cache?
mlseim Posted March 19, 2013 Author Posted March 19, 2013 I figured it out. It turns out that the script I was using it on (not the test script that I listed), connects to the MySQL database and displays data on the web page from that database. The AJAX chainselect menu is also on that page. When you select something, the javascript (AJAX) does a get to another PHP script to display the 2nd tier of the menu. It's at that point where it failed. Both my page data AND the AJAX scripts are using the same database (but different tables). So, to make a long story short ....I'm essentially connecting twice to the same database. My fix .... On the main page, I am now doing this: mysql_connect("localhost", "lechtes", "mypassword") or die(mysql_error());mysql_select_db("lechtes_profile") or die(mysql_error()); On the AJAX script (func.php) that is processing the chainselect, I am now doing this: mysql_connect("localhost", "lechtes", "mypassword",TRUE) or die(mysql_error());mysql_select_db("lechtes_profile") or die(mysql_error()); The 2nd connection is a "new link" to the same database (using the new link parameter). That eliminated the MySQL connection errors. Thanks everyone for this forum. I've learned a lot by looking at other posts as well.Discussions on this forum that I don't find on other forums ... nice!
Ice IT Support Posted March 19, 2013 Posted March 19, 2013 Glad your question got answered! Please spare a few minutes to take our brief survey: http://feedback.heliohost.org/ Your participation in this survey is greatly appreciated.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now