I am trying to execute "select query" between two nested while loops in mysqli queries but it's not working.
Table Structure
Id  ArticleId   UserIp
----------------------
1    10       116.202.34.165
2    99       106.220.38.195  
3    10       116.202.34.165  
4    25       74.192.24.105  
Above have table structure
/*** Get All Unique IP Address List ***/
$userip=mysqli_query($dbcon,"select distinct(UserIp) from pageview where date between date_sub(now(), interval 30 day) and now()");
/*** Get All Unique Articles List ***/
$articleid=mysqli_query($dbcon,"select distinct(ArticleId) from pageview where date between date_sub(now(), interval 30 day) and now()");
/*** Fetch IP List ***/
while($iplist=mysqli_fetch_array($userip)){
/*** Fetch Article List ***/
    while($articlelist=mysqli_fetch_array($articleid)){
        $usrip= $iplist['UserIp'];
        $artid= $articlelist['ArticleId'];
    /*** Get Unique Visiter List ***/
        $unique_data= mysqli_query($dbcon,"select * from pageview where UserIp='$usrip' and ArticleId='$artid' ");
    }
}
I have required total unique visitor. 1) If 1 UserIp have two times same article id so we have to exclude that, Otherwise we have to count and print total views.
 
    