php - How to echo only one parameter with union all -


i have database tables. want print union names both tables , if there more 1 name appears print once , make red example. php:

<?php     include 'verification/verify_form_details.php';      $result5 = getusers();     if (!$result5) {         die('invalid query: ' . mysqli_error());     }        while($row5 = mysqli_fetch_array($result5))     {           $username = $row5['username'] ;         echo '<ul>';             echo"<li>". $username ."</li>";         echo '</ul>';        }            ?> 

and query:

function getusers() {     global $con;     $sql = "select username `user_project`              union              select username `user`";     return mysqli_query($con,$sql);  } 

how can achieve this?

modify query group user name

    $sql = "select username              (             select username `user_project`              union              select username `user`             )             group username"; 

also if want number of appearance can make red having multiple occurrence

$sql = "select username, count(username)                  (                 select username `user_project`                  union                  select username `user`                 )                 group username"; 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -