How to connect MySQL to PHP? -


so i'm brand spanking new mysql , php.

i'm set mysql workbench , i'm practicing building site using notepad++ , run through chrome. want create sign page, i'm assuming use .php page on site, username , password. that's it. can't seem find tutorials on how connect mysql .php page, or how create sign in page. appreciated!

welcome php!

typically connection established on php page along lines of this:

$conn = mysqli_connect("localhost","[username]","[password]","[databasename]") or die("error " . mysqli_error($conn));  

the "or die" produce error if there's problem establishing connection. also, uses newer "mysqli_" method connection; make sure when call connection in future use mysqli_ methods (there still traditional "mysql_" methods available, depreciated).

hope helps!

m


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -