i figured it out. yay.
instead of:
if ($result) {
i used:
if (mysql_num_rows($result) > 0) {
go me.
anjeela wrote:
hi.
i'm fairly new to php, so please forgive me if the answer to the following question is obvious. at any rate, onto my problem:
i am creating a searchable FAQ database, the specific part i am having problems with is when looking for the keyword. this is what i have:
$query = "select * from faq where question like '%$keyword%'";
$result = mysql_query($query);
if ($result) {
blah blah blah
} else {
blah blah.
}
that works all fine and dandy when it finds the keyword. however, if it doesn't find the keyword $result takes "Resource id #3" as it's value. so if ($result) thinks it's actually getting something of substance and takes it instead of passing it along to else, and i get a blank page because the other statements were not 'fulfilled' to their liking, as opposed to echoing that it has found no match for $keyword.
any help would be appreciated.