[PHP-DB] Functions returning opposite than expected From: Tyson Lloyd Thwaites (tysonlt <email protected>)
Date: 08/31/00

Hi all,

I am still having fun and games with functions returning the opposite of
what I expect.

Example:

                        if (!preg_match('/SELECT/i', $this->qry)) {
                            echo "TRACE: select";
                            while (odbc_fetch_row($this->qry))
 $this->rowcount++; }
                        } else {
                            echo "TRACE: action";
                            $this->rowcount = odbc_num_rows($this->qry);
                        }

Please note that '!' in front of preg_match. If I leave it off (which would
make sense, right?) it branches to the wrong part, ie if I run a select
query, it would branch to the action part and vice versa. I have had to
negate a few functions in tests like that, and I think that either I'm
missing something embarrasingly obvious (like, I'm mad) or PHP is doing some
wierd stuff.

Another thing I tried doing is this:
    if (preg_match('/select/i', $this->qry)==true) {

But sure enough, unless I change the true to false, I get the opposite of
what I expect.

Please help! And try to be nice to me if it's a stupid mistake! ;)

Regards,

Tyson Lloyd Thwaites
IT&e Ltd

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>