Copy link to clipboard
Copied
When I try to create a database connection, I get the message
"Your PHP server doesn't have the MYSQL module loaded or you can't use the mysql_(p)connect functions."
My server uses mysqli and PHP 7
How can I tell Dreamweaver to use these versions to connect?
1 Correct answer
Copy & paste this into a new .php file. Change username, password and database as required.
<?php
$con = mysqli_connect("localhost","username","password","database");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else echo "Successfully connected, happy coding!"
?>
<?php phpinfo() ?>
Save and Open in browser. See screenshot.
Copy link to clipboard
Copied
pabirds wrote
When I try to create a database connection, I get the message
"Your PHP server doesn't have the MYSQL module loaded or you can't use the mysql_(p)connect functions."
My server uses mysqli and PHP 7
How can I tell Dreamweaver to use these versions to connect?
If you use PHP 7 you can only connect using mysqli (the i standing for improved or you can use PDO) I'm afraid the mysql function is deprecated and no longer works with PHP 7. You would have to drop back to PHP 5.
You should NOT use the old mysql function for any new project going forward, its well past its sell by date.
Copy link to clipboard
Copied
Copy & paste this into a new .php file. Change username, password and database as required.
<?php
$con = mysqli_connect("localhost","username","password","database");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else echo "Successfully connected, happy coding!"
?>
<?php phpinfo() ?>
Save and Open in browser. See screenshot.
Copy link to clipboard
Copied
pabirds wrote
How can I tell Dreamweaver to use these versions to connect?
In CC 2018 under Preferences > PHP, you now have a choice of PHP versions to code with.

