I have a question. I'm using a script that will check the domain in my database. If got a match then it will be TRUE
.
while( $row = mysql_fetch_array($result) ) {
echo var_dump($phpgsb->doLookup($row['origin'])). " - ". $row['origin'];
echo "<br>";
}
$row['origin']
is an array of domain. Example:
test.com
lol.com
what.com
blabla.com
And the output I'm getting is:
bool(false) - test.com.
bool(false) - lol.com.
bool(true) - what.com.
bool(false) - blabla.
what.com is in my database so it's a TRUE
. Now the problem is I don't know how to use/capitalize/exploit (I'm sorry my English is not good) the true result. Is there anyway I could create in the while
loop:
if (bool == true) {
only echo the true result
}
I have did this with associative arrays results. I don't know how to do it boolean
.
If you're trying to find the record that $phpgsb->doLookup($row['origin'])
returns true
when passing in the current row of your db query, do:
while ($row = mysql_fetch_array($result)) {
if ($phpgsb->doLookup($row['origin']) === true) {
echo var_dump($phpgsb->doLookup($row['origin'])). " - " . $row['origin'];
echo "<br>";
}
}
Note the ===
, which checks type AND value. ==
is a falsy check and therefore could return conditions that evaluate 0 == false
(or 1 == true
) as a true statement(s).