Jump to content

No Database selected?


gizmorattler

Recommended Posts

I've tried to connect the join form parse to my database with an external connect_to_mysql.php file... here's the script in that file:

 

<?php 

// Place db host name. Sometimes "localhost" but 

// sometimes looks like this: >>      ???mysql??.someserver.net

$db_host = "localhost";

// Place the username for the MySQL database here

$db_username = "root"; 

// Place the password for the MySQL database here

$db_pass = "*******"; 

// Place the name for the MySQL database here

$db_name = "mysql";

 

// Run the connection here 

$myConnection = mysqli_connect("$db_host","$db_username","$db_pass", "$db_name") or die ("could not connect to mysql"); 

// Now you can use the variable $myConnection to connect in your queries     

?>

 

The name of the database I'm using is , mysql... Why is it saying no database selected?

Link to comment
https://forums.phpfreaks.com/topic/186365-no-database-selected/
Share on other sites

Extension?.... I don't understand...

 

Do you mean my localhost server? Like when I test the script; are you saying that I'm supposed to set a "mysqli" preference in php admin or something?

 

No. Your using the mysqli extension to make your connection. mysqli_connect. I'm asking, are you sticking with that extension to execute your queries? eg; mysqli_query.

Link to comment
https://forums.phpfreaks.com/topic/186365-no-database-selected/#findComment-985101
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.