Chris
Chris

Reputation: 67

PHP - in_array problems

I wrote the following, but its saying that its the 'wrong datatype'.

Could someone tell me where im going wrong.

$newQuery = mysql_query("SELECT * FROM table WHERE left_id='$authId'");
$catid = mysql_fetch_array($newQuery);

if(in_array("99", $catId)){
    // A Director
} else {
    // A Researcher
}

Cheers,

Upvotes: 0

Views: 417

Answers (1)

shankhan
shankhan

Reputation: 6571

You are assigning the row to $catid and later using $catId. Notice the capital "I". You also need to make sure $catId is an array because mysql_fetch_array will return FALSE if there are no rows.

Upvotes: 8

Related Questions