I have got the results from the several sql phrase in php-MySQL. My $sql1 and the result query phrases is as like below.
$sql1= "SELECT code_co.code, code_co.disease_co, code_en.disease_en, ds.ds_url
FROM code_co
LEFT JOIN code_en ON code_en.code = code_co.code
LEFT JOIN note ON note.code = code_co.code
...
where condition
$result1= mysqli_query($con,$sql1);
But I have the 9 sql query phrases as like above code. selected columns are same in the 9 sql query. That is
$sql2= "SELECT code_co.code, code_co.disease_co, code_en.disease_en, ds.ds_url
FROM code_co
LEFT JOIN code_en ON code_en.code = code_co.code
LEFT JOIN note ON note.code = code_co.code
...
where condition
$result2= mysqli_query($con,$sql2);
...
$sql9= "SELECT code_co.code, code_co.disease_co, code_en.disease_en, ds.ds_url
FROM code_co
LEFT JOIN code_en ON code_en.code = code_co.code
LEFT JOIN note ON note.code = code_co.code
...
where condition
$result9= mysqli_query($con,$sql9);
Finally I want to get the intersection of the 9 results, but MySQL is not supported. So I want to solve that by php code. That is array_intersect() function. But I am at a loss how I use that.
while($row1= mysqli_fetch_array($result1))
while($row2= mysqli_fetch_array($result2))
....
while($row9= mysqli_fetch_array($result9))
$intersect = array_intersect($row1, $row2, $row3, $row4, ...., $row9);
print_r($intersect);
mysqli_close($con);
?>
There is no error message but, nothing is displayed. I first use array_intersect function in this code. please, Give me a piece of advice. Thank you for your concern.