I have two sql server queries in php and I want to compare them.
I have them as follows:
-
$variable1
has N amount of data. -
$variable2
has N amount of data.
Both variables save SQL Server queries from different tables but have the student number in common, what $variable1
contains the total number of students and $variable2
contains only some ... I want it show the ones that are the same in both variables ... I have the following code but it does not work
if($variable1 == $variable2){
$con++;
$variable1;
$variable2;
}else {
if(($variable1 == $variable2) == null){
$con++;
$variable1;
$variable2;
}
}
variable1 contains the following
1
2
3
4
5
6
7
8
9
10
and variable 2 contains the following
2
4
7
9
What I want to get is the following
1
2 2
3
4 4
5
6
7 7
8
9 9
10