foucquet Posted November 20, 2009 Share Posted November 20, 2009 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 More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 there could be something wrong with your query ? it might not be returning any rows Link to comment https://forums.phpfreaks.com/topic/182272-function-problems/#findComment-961809 Share on other sites More sharing options...
foucquet Posted November 20, 2009 Author Share Posted November 20, 2009 there could be something wrong with your query ? it might not be returning any rows So is there a way to check if that is the case? Link to comment https://forums.phpfreaks.com/topic/182272-function-problems/#findComment-961813 Share on other sites More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 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. Link to comment https://forums.phpfreaks.com/topic/182272-function-problems/#findComment-961816 Share on other sites More sharing options...
foucquet Posted November 20, 2009 Author Share Posted November 20, 2009 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 More sharing options...
foucquet Posted November 20, 2009 Author Share Posted November 20, 2009 there could be something wrong with your query ? it might not be returning any rows Hmm, you were right, just ran the query throught PHPMyAdmin and it indeed returns zero rows, so it's back to the drawing board methinks... Link to comment https://forums.phpfreaks.com/topic/182272-function-problems/#findComment-961820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.