Hello PHP guys,
Could anyone tell please why it ends with an error saying "Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\david1.php on line 7" ? Here is the small script :
----------------------
<?php
$connection = mysql_connect("localhost" , "root" , "myPassword") or die(mysql_error());
$database = mysql_select_db("david") or die(mysql_error());
$david = "SELECT actor FROM film";
$update = "UPDATE film SET actor='Jim' WHERE actor='John'";
$result = mysql_query($update,$david) or die (mysql_error());
while ($row = mysql_fetch_array($result))
{ echo $row['actor']; }
//$movie_name = $row['actor']; }
?>
--------------------------------
Regards.
Could anyone tell please why it ends with an error saying "Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\david1.php on line 7" ? Here is the small script :
----------------------
<?php
$connection = mysql_connect("localhost" , "root" , "myPassword") or die(mysql_error());
$database = mysql_select_db("david") or die(mysql_error());
$david = "SELECT actor FROM film";
$update = "UPDATE film SET actor='Jim' WHERE actor='John'";
$result = mysql_query($update,$david) or die (mysql_error());
while ($row = mysql_fetch_array($result))
{ echo $row['actor']; }
//$movie_name = $row['actor']; }
?>
--------------------------------
Regards.