I had a function that on success returns the number of rows affected and on failure returns false. The trouble is, if 0 rows are affected you can't do the following:

if ($success) {
    echo 'order updated successfully';
} else {
    echo 'There was a problem updating the order';
}

It will echo the error message.

You need to do this:

if ($success !== false) {
    echo 'order updated successfully';
} else {
    echo 'There was a problem updating the order';
}

This page on the PHP site is helpful.


CategoryProgramming

Php/ZeroOrFalse (last edited 2006-04-01 16:58:08 by scorpio)