Copy link to clipboard
Copied
Ive been trying for two days now to connect to mysql in Dreamweaver but when i enter all my details into the 'mysql connection' dialog box and press test or if i try to select a database i keep getting an alert message saying " An unidentified error has occurred" What have i done wrong???
Appreciate any help!!
Copy link to clipboard
Copied
Moved to the Develop server-side applications in Dreamweaver forum.
Is the MySQL server running?
Have you defined the site correctly?
Copy link to clipboard
Copied
Well the mysql server has been set up via my server host in phpmyadmin so i believe it should always be running. The site is setup to my server host and tells me it has connected successfully. If i go to my website (www.milesfunerals.com/donations_2.php) and put in a search which searches the database, it brings up a page to say "no databased selected" but my database panel in Dreamweaver there is a database present but there are no tables, although i know there are as i exported the database from the local site phpmyadmin and imported it into the remote site phpmyadim . I try double clicking the database (milesdata) in Dreamweaver which shows in the database panel, which then brings up the mysql connection dialog box and try to enter details again and search for the database again and thats when it comes up with "unidentified error has occurred" but i dont no why or how to correct it. I am new to Dreamweaver so i could well have done something wrong when trying to transfer everything from my testing server to remote server.

Copy link to clipboard
Copied
You appear to have a couple of different, albeit related problems.
One problem appears to be that you're trying to access your remote database within Dreamweaver. Most hosting companies prevent remote access to a database for security reasons. Although you can use a remote database as your testing server, it's not recommended.
The other problem is that when you click the Search button in your donations_2.php page, you get the message "No database selected". That indicates that the file in the Connections folder doesn't have the correct database details. The connection script (in the Connections folder) should contain something like this:
$hostname_connAdmin = "localhost";
$database_connAdmin = "mydatabase";
$username_connAdmin = "admin";
$password_connAdmin = "secret";
On most hosting companies, "localhost" is the correct value for hostname. You need to check that the name of the database is correct.
Setting up this type of connection can be difficult if you don't have experience with PHP/MySQL. The best way to do it is to use the same setup locally as on your remote server. For example, give your local version of the database the same name and structure as the remote version. Also use the same username and password.
You should also be aware that Dreamweaver's server behaviors are being withdrawn because they use outdated code that will eventually stop working. You're safe for the time being, but you will eventually need to replace the PHP code generated by Dreamweaver with more up-to-date code.
Copy link to clipboard
Copied
Ok thank you. Could you advise me on the best way to update the this code when the time comes?
Copy link to clipboard
Copied
You will need to convert all the code to use MySQL Improved (MySQLi) or PDO. Unfortunately, it's not a simple case of swapping out one set of functions for another. The entire code needs to be rewritten.
Adobe has not announced any plans to update the server behaviors. It might do so at a later date. On the other hand, it might not. If you're interested in learning how to hand-code connections to a database, you might want to take a look at my book PHP Solutions, 2nd Edition. Alternatively, do a search for MySQL Improved tutorials.
Copy link to clipboard
Copied
Go to your File Manager on your server and look for the the folder _mmServerScripts. Delete it. Then reload your website in any webbrowser (it will re-create the folder). Now try connecting to your database.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now