Tutorial: Doing basic MySQL database stuff
This tutorial is quite easy. If you want to connect to a mysql database you can use something like this:
-
$host = 'localhost';
-
$username = 'yourusername';
-
$password = 'yourpassword';
-
$databasename = 'yourdbname';
-
-
//don't edit this stuff okay?
-
-
-
if($connect == true){
-
echo 'Connected fine!';
-
} else {
-
echo 'Bad Username or Password.....or host dummy!!!!';
-
}
-
-
if($selectdb == true){
-
echo 'Connected to DB master :D';
-
} else {
-
echo 'Cant find that database....did we connect?';
-
}
So this code basically connects to the database and says hi!
More to come on DB Functions ![]()
