سؤال

I have been working on a project using AMFPHP and flash. I did the php stuff only. A function in amf that gets result from 3 tables and store their results in 1 array and returns was working perfectly but for a few days it has stopped. The strange thing is that if I return results separately they work but the final array is never returned and am unable to see any response from AMFPHP call in its test browser.

in the code i have mentioned that every point is getting proper result from DB and have tested that from that its retuning result properly.

Another thing seems strange is that the partial results I return comes fine but at he start and end thier is something that is not for other functions which are working:

(mx.collections::ArrayCollection)#0
  filterFunction = (null)
  length = 6
  list = (mx.collections::ArrayList)#1
    length = 6
    source = (Array)#2

RESULT

uid = "8BEDEF32-4BED-E1A4-56A0-F227EDD40026"
  sort = (null)
  source = (Array)#2

here is the function

function getDefaultValuesForAvatarsLocal($jockey_type=NULL){
        $defaultValues = array();
        $sql = "SELECT * FROM default_values";
        $defaultBLValues = $this->db->query($sql);
        $numRows = $this->db->num_rows($defaultBLValues);
        if($numRows > 0){
            $defaultValues['BLP'] = $defaultBLValues; /* IF RETURN THIS GETS RESULT */
            if($jockey_type){
                $sql = "SELECT jockey_clothing_categories.type, jockey_clothing_items.* FROM jockey_clothing_items 
                        JOIN jockey_clothing_categories
                        ON(jockey_clothing_items.category_id = jockey_clothing_categories.id)
                        WHERE jockey_clothing_items.is_default = 1 AND jockey_clothing_items.jockey_type = ". $jockey_type;
                $defaultJockeyClothings = $this->db->query($sql);
                $numRows = $this->db->num_rows($defaultJockeyClothings);
            }
            if($numRows>0){
                if($jockey_type){
                    $defaultValues['DJC'] = $defaultJockeyClothings; /* IF RETURN THIS GETS RESULT */
                }
                $sql = "SELECT horse_avatar_clothings_categories.type, horse_avatar_clothings_items.* FROM horse_avatar_clothings_items 
                        JOIN horse_avatar_clothings_categories
                        ON(horse_avatar_clothings_items.category_id = horse_avatar_clothings_categories.id)
                        WHERE horse_avatar_clothings_items.is_default = 1";
                $defaultHorseClothings = $this->db->query($sql);
                $numRows = $this->db->num_rows($defaultHorseClothings);
                if($numRows>0){
                    $defaultValues['DHC'] = $defaultHorseClothings; /* IF RETURN THIS GETS RESULT */
                    #return $defaultValues; /* NOT RETUNING THE FINAL ARRAY FROM THIS POINT EITHER */
                }else{
#                   return false;
                }
            }else{
#               return false;               
            }
            #return 1333;
            /* THE CONTROL COMES HERE PROPERLY BUT NOT RETUNING THE BELOW ARRAY BUT IS RETUNING ANY TEST TEXT
                LIKE return "I AM HERE"; WILL RETURN THE TEXT PROPERLY
            */
            return $defaultValues;
        }else{
            return false;
        }
    }

Any help would be appreciated Reagrds

هل كانت مفيدة؟

المحلول

Well, I got the answer..

Just posting it here for anyone facing same issue

just modified the line

return $defaultValues;

to

return (object)$defaultValues;

and called the function like this

$defaultValues = (array)$this->getDefaultValuesForAvatarsLocal();

no idea why this is working fine with these changes because it was working properly in past without any changes. If anyone can explain that it would be great for me and any other user around.

Regards

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top