Verify an item in an array

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Tue Jan 28, 2003 4:11 pm

Code: Select all

$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)) {
    print "Got Irix";
}

http://www.phpfreaks.com/phpmanual/page ... array.html

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Post by Redcircle » Fri Jan 31, 2003 1:45 am

try

Code: Select all

$name = "John"; 
if (in_array ($name, $Row)) {
print "Hello, $name";
}


$Row['Names'] is not an array it's a string. $Row is the actual array of the result.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests