Beginning PHP5 (mysql_query) question
Hi
This may be a daft question but I'm just beginning AMP. I'm working my way though Beginning PHP.Apache,MySQL Web Dev book. I'm on chapter 4, page 114. I'm just trying to figure out why the $link var is in '$result = mysql_query($query, $link) or die(mysql_error());'code? See example below:
<?php
$link = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("moviesite") or die (mysql_error());
$query = "SELECT movie_id, movie_name,movie_director,movie_leadactor
FROM
movie";
$result = mysql_query($query, $link) or die(mysql_error());
The code works OK with the $link removed from the mysql_query code.
Thanks
ShiningTor
|