gizmorattler Posted December 26, 2009 Share Posted December 26, 2009 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 More sharing options...
fenway Posted December 27, 2009 Share Posted December 27, 2009 I don't see a call to mysql_select_db(). Link to comment https://forums.phpfreaks.com/topic/186365-no-database-selected/#findComment-984573 Share on other sites More sharing options...
trq Posted December 28, 2009 Share Posted December 28, 2009 I don't see a call to mysql_select_db(). Because mysqli_connect excepts your database name as your 4th argument. To the OP, are you sure your using the mysqli extension to attempt to execute your queries? Link to comment https://forums.phpfreaks.com/topic/186365-no-database-selected/#findComment-984766 Share on other sites More sharing options...
gizmorattler Posted December 28, 2009 Author Share Posted December 28, 2009 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? Link to comment https://forums.phpfreaks.com/topic/186365-no-database-selected/#findComment-984916 Share on other sites More sharing options...
trq Posted December 28, 2009 Share Posted December 28, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.