Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.