Highlighted

Mysqli connection

New Here ,
Nov 29, 2017

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?

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

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.

CC-Preview-in-browser.jpg

Views

984

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Mysqli connection

New Here ,
Nov 29, 2017

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?

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

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.

CC-Preview-in-browser.jpg

Views

985

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 29, 2017 0
LEGEND ,
Nov 29, 2017

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 29, 2017 0
Adobe Community Professional ,
Nov 29, 2017

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.

CC-Preview-in-browser.jpg

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 29, 2017 0
Adobe Community Professional ,
Nov 29, 2017

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.

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 29, 2017 0