ala888 Posted July 30, 2014 Share Posted July 30, 2014 whats the point of mysqli_select_db if I can just refine my queries via schemas ? Instead of saying mysqli_select_db('somedb','someconnection'); //do my query stuff. cant I just do ? //do my query stuff on `somedb`.`sometable` ? Link to comment Share on other sites More sharing options...
niche Posted July 31, 2014 Share Posted July 31, 2014 Queries are for tables. mysqli_select_db changes the default database for the connection. as per the tuts. http://www.w3schools.com/php/func_mysqli_select_db.asp Link to comment Share on other sites More sharing options...
justsomeguy Posted July 31, 2014 Share Posted July 31, 2014 I believe that a connection to MySQL requires a specific database. It's still possible to do queries across multiple databases if your user account has access, but connecting requires a specific database (and a user with access to that database). Link to comment Share on other sites More sharing options...
ala888 Posted August 1, 2014 Author Share Posted August 1, 2014 So essentially, I can be like mysqli_connect("localhost","root","password"); since generic db is optional parameter and since I am the root user I can just query multiple databases via schema, yes? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 1, 2014 Share Posted August 1, 2014 I believe so. I run queries across multiple databases in phpMyAdmin, which obviously is written in PHP. I assume they use mysqli to do that. That's the only experience I have doing that though, I haven't written any applications that try to use multiple databases. 1 Link to comment Share on other sites More sharing options...
niche Posted August 2, 2014 Share Posted August 2, 2014 Never thought of that before. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now