PHP code for database connection and querry

PHP code for database connection and querry:

$link = mysql_connect("localhost", "root", "pass") or die("connection error");
mysql_select_db("database",$link);


Querry code:
$vec=mysql_query("SELECT * FROM PHOTOS");
for($i=0;$i"<"mysql_num_rows($vec);$i++)

(Take the "" out)
{
mysql_data_seek($vec,$i);
$a=mysql_fetch_row($vec);
echo"$a[0] $a[1] $a[2]";
}

Where $a[0] it's the first field in the querry result.