0

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,

1
  • 1
    For variable names PHP does impose case sensitivity, if only function names acted in the same manner... Commented Feb 1, 2011 at 5:56

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

+1. @Chris, just another crazy thing about PHP... variables are case-sensitive, but function are not... Man this language pisses me off sometimes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.