Mysql experts come in to help solve a problem. thank you for connecting to the database $ dbmysql_connect ($ db_host, $ db_user, $ db_passwd) ordie (Cannotconnecttodatabase); mysql_select_db ($ db_name) ordie (Nodatabase ); $ q31 & quot; selec mysql experts come in to help solve a problem, thank you
// Connect to the database
$ Db = mysql_connect ($ db_host, $ db_user, $ db_passwd) or die ('Can not connect to database ');
Mysql_select_db ($ db_name) or die ('No database ');
$ Q31 = "select * from member where sh1 = '$ arr [sh1]' and status = '0' order by id Limit 0, 10 ";
$ R31 = mysql_query ($ q31, $ db );
While ($ a31 = mysql_fetch_array ($ r31 ))
{
$ Id. = "$ a31 [id]";
}
// Among the 10 data records output above, do I need to further compare the IP addresses of the 10 data records with the ID "1005? I cannot write it like this:
$ Data = "1005 ";
Foreach ($ id as $ data)
{
Echo "include ";
} Else {
Echo "does not contain ";
}
// Please help me write the most efficient code. thank you!
------ Solution --------------------
I wrote
/If you want to obtain the data before determining
$ Myid = array ();
While ($ a31 = mysql_fetch_array ($ r31 )){
$ Id = $ a31 ['id'];
$ Myid [] = $ id;
}
Foreach ($ Myid as $ Idvalue ){
If ($ Idvalue = 1005 ){
Echo 'Id list contains 1005 ';
Break;
}
}
If you want to ask a question later, make it clear whether there is an id equal to 1005 or if the $ a31 [id] array contains 1005