如何将一个表中的值数组与另一个表匹配,并使用php显示匹配的值

时间:2021-12-10 13:43:08

I have two tables. One is registration. From registration table i want to select username based on particular city. And I also have second table from which I have to select Username whose active flag is set to true. And from both tables i have to display those usernames which ae matched in both tables. want immediate help.

我有两张桌子。一个是注册。从注册表我想根据特定城市选择用户名。我还有第二个表,我必须从中选择其活动标志设置为true的用户名。从两个表中我必须显示两个表中匹配的用户名。想要立即帮助。

1 个解决方案

#1


0  

let $array1 and $array2 are two arrays then:

让$ array1和$ array2是两个数组:

$mached = array();
foreach($array1 as $val)
{
    if(in_array($val, $array2))
    {
        $mached[] = $val;
    }
}

the array $matched contains all the matched values...

数组$ matched包含所有匹配的值...

#1


0  

let $array1 and $array2 are two arrays then:

让$ array1和$ array2是两个数组:

$mached = array();
foreach($array1 as $val)
{
    if(in_array($val, $array2))
    {
        $mached[] = $val;
    }
}

the array $matched contains all the matched values...

数组$ matched包含所有匹配的值...