There's many ways to connect to a MySQL database.
But before we start, you will need the following:
After you have those, let's get started!: First, set a variable to our MySQL connection(mysql_connect), and give it values.
<?php
$connection = mysql_connect("host name", "username", "password")
if($connection) mysql_select_db("database name") or die("Couldn't connect to database!")
echo "Connected to MySQL!"
?>
Save that file as mysql_connection.php.
Now, to explain. The first line, after the "<?php", just sets our mysql_connect() function to it so that we can use the variable to tell if it succeeds or fails.
After that, we use our if($connection) to see if the $connection variable failed or succeeded. If it did, set our database using mysqlselectdb().
NOTE: If you see "Connected to MySQL!" you followed the tutorial right!:)
Comments for this tutorial (7)
How can I connect to a MySQL database? what is the link of my Mysql database? ***.yakkel.com/(Mysql database)???
Just follow this tutorial to connect to a MySQL database. There is no link to an MySQL database.
How to do it!
Just follow this tutorial. Guys, the point of tutorials is to teach you things. Just follow the steps in this and you're golden
Welcome!
Yakkel is your central source for web developer tutorials as well as a leading free web hosting provider.
500mb storage space
FTP access, unlimited email accounts, unlimited subdomains!
Host all your domains, for free!
learn more by taking a quick tour ›
learn about our free hosting ›
signup now ›
About this tutorial
I'll show you how to connect to a MySQL database, duh!:P
category
tagged with
published by
t0m on november 4th
viewed
418 times
comments
Sponsored links
Related
How to use jQuery plugin jGrowl
How to change permissions of a file or folder
How to make a new file in FileZilla
How to find your myspace FRIEND ID
Using Filezilla to upload your files to Yakkel
How to redirect a domain with htaccess
How to setup your very own Gravatar
How to login to phpMyAdmin on Yakkel
How to put your profile on private
You have to use like php or a programming language to "connect" to a database, there's not like a link to it.
Just follow this tutorial to connect to a MySQL database. As 786 dude said, there's no link.