Re: function not returning TRUE

From: Date: Wed, 13 Feb 2002 07:20:06 +0000
Subject: Re: function not returning TRUE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84542@lists.php.net to get a copy of this message
Hi Nick, did you double-check your query ($qry)? Run it from the mysql client or from phpMyAdmin to make sure its returning some rows of data. Cheers, Bart Nick Wilson wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all Can anyone see any reason why this function does not appear to be returning true? It appears to be returning 1 though? [snip snip]
        if(!$this->_db_connect()) {
            return FALSE;
        }
                    if(!($result=mysql_query($qry))) {
            return FALSE;                } else {
                        /* Set properties */
            $this->set_content_table($content_table);
            $this->set_tip_section($section);
            $this->set_auth_id($auth_id);
            $this->set_tip_id(mysql_insert_id());
            $this->set_tip_title($title);
            $this->set_tip_description($desc);
            $this->set_tip_keywords($keywords);
            $this->set_tip_text($text);
            return TRUE;
        }                    return TRUE;
    }
the way I'm testing the condition is like:
    $test=myfunction();
    if($test) {
        do x
    } else do y


« previous php.general (#84542) next »