My main script ============================ $result = new questions(); $result->ShortListCategories($lang);
$temp=""; $test=explode("",$result); ksort($test); reset($test); foreach ($test as $ab=>$ac){ $temp.="<OPTION VALUE=\"$ab\">$ac\n"; } ================================ everything before $temp=""; is working fine :) ive added / re-added / changed the rest of the code a dozen times- trying to get it to work... Here is the function :- ====================================== Function ShortListCategories($lan) { $query = "SELECT category_id, category_name FROM categories ORDER BY category_id"; $result=mysql_query($query) or die(mysql_error()); global $categories; while ($row = mysql_fetch_array($result)) { $temp=trim($row[0]); $categories[$temp]=trim($row[1]); } reset($categories); return ($categories); } ======================================= everyting after (& including) global $categories; Ive added / re- added & changed the codse a dozen times - & nothing works... Basically, WITHIN the function - I can loop / read / view the $categories array - & everything works fine - So i KNOW the data is being stored correctly... However, No matter what i do, I cannot "return" this/these value(s) back to the main script... my "latest" error message is - Object of class questions could not be converted to string in (main script file) etc.... Is it possible to retrieve the value from the function - & how ? PS, Ive found lots of online tutorials - where the function is includedin the *same* file as the main script.. - But hardly / not enough examples - where the function is in a class - held in a different file to the main script... - Unless the example is $test=5; return $test; etc (very basic script - I find) Thanks