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
Post a Comment