Welcome Guest, Not a member yet? Register   Sign In
why does this model work in PHP5 but not PHP4.4?
#1

[eluser]jng[/eluser]
I have made this on my mac, which I realized has the latest version of PHP so my guess is what this is not working?

To remove all the IF ELSE PHP logic from view, I moved it to the model, but maybe this logic is also wrong?

Basically any of the new properties like "foundclass", "hasTruppengattung", etc. don't show up on my webserver with PHP4 and instead just returns "Message: Undefined property: foundclass".

Thank you for any help you can provide.


Code:
<?php
class Bayern_model extends Model {
    
    function getAll() {

        
        $q = $this->db->query("SELECT * FROM people ORDER BY last_name");
        
        if($q->num_rows() > 0) {
            foreach ($q->result() as $row) {
                $data[] = $row;
                
                $date = explode("-",$row->birthdate);
                //date("d M Y", mktime(0, 0, 0, $date[0], $date[1], $date[2]))
                
                $row->birthinfo = ($row->birthdate!="0000-00-00") ? "geb. " . date("d M Y", mktime(0, 0, 0, $date[1], $date[2], $date[0])) : "";
                $row->birthinfo .= ($row->birthplace!="") ? ", " . $row->birthplace : "";
                $row->foundclass = ($row->isFound) ? "found" : "notfound";                
                
                $row->hasTruppengattung = ($row->truppengattung!="") ? true : false ;
                $row->hasFormation = ($row->formation!="") ? true : false ;
                $row->hasTruppenteil = ($row->truppenteil!="") ? true : false ;        
                $row->hasServiceInfo = ( $row->hasTruppengattung || $row->hasFormation || $row->hasTruppenteil ) ? true : false ;
                
                
                $row->hasNotes = ($row->notes!="") ? true : false ;                
                $row->hasSource = ($row->sourceLink!="") ? true : false ;
                $row->hasScan = ($row->recordScan!="") ? true : false ;
                
                $row->searchURL = "http://mywebsite/?firstname" . $row->first_name . "&lastname;=" . $row->last_name;
                if($row->birthdate!="0000-00-00")
                    $row->searchURL .= "&birthyear;=" . $date[0];
            }
        return $data;
        }
    }
    
    
}


Messages In This Thread
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 03:18 AM
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 03:55 AM
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 04:29 AM
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 05:06 AM
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 06:02 AM
why does this model work in PHP5 but not PHP4.4? - by El Forum - 09-02-2010, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB