mysql_connect()
and mysql_select_db()
are needed in different web pages with access to the database.
The connection and selection of the database are put in a different file:
db.php
<?php $link = mysql_connect("localhost" , "root", ""); if($link == false) { echo "Error: can't connect to database server"; exit; } if(mysql_select_db("minifacebook", $link) == false) { echo "Error: can't connect to database"; exit; } ?>