Jump to content

Function problems


foucquet

Recommended Posts

I am having a slight problem with a function, I know that I have probably done something quite stupid, but can't see what. This is the function in question, I think it is quite self explanatory:-

 

30 function get_director(){
31     global $filmdirector;
32     global $director;
33     $query_d = "SELECT name FROM people WHERE peopleid='isdirector'";
34     $results_d = mysql_query($query_d)
35     or die(mysql_error());
36     $row_d = mysql_fetch_array($results_d);
37     extract($row_d);
38     $director = $name;
39     }

 

The error message I get is :-

 

Warning: extract() expects parameter 1 to be array, boolean given in C:\wamp\www\php projects\table2.php on line 38

 

Notice: Undefined variable: name in C:\wamp\www\php projects\table2.php on line 39

 

Which I understand, but can't see the solution for. I am quite new to all this, so it would be appreciated if replies colud be reasonably simply explained...

Link to comment
https://forums.phpfreaks.com/topic/182272-function-problems/
Share on other sites

run the query in phpmyadmin if you have one, however I feel its a very generic query and will always return the same result its not connected to any specific record.

 

Thanks will give that a try. It is supposed to be a generic query to pull all of the directors of a list of films from the 'people' table...

Link to comment
https://forums.phpfreaks.com/topic/182272-function-problems/#findComment-961819
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.