where i went wrong please help urgent

<?php include 'dbConfig.php';
        <div class="table" style="display: <?php echo isset($_POST['find']) ? "none" : "block" ?>">

        <table class="table table-bordered table-striped msg-reports-table" id="table" display="">
      //$res=mysqli_query($db,"Select f.fname,f.sname,f.mail,f.num,f.gen,s.tadd,s.padd,s.amail,s.anum,s.status from first f,second s ");
//echo $$sql1="select f.fname,f.sname,f.mail,f.num,f.gen,s.tadd,s.padd,s.amail,s.anum,s.status from 
// ( SELECT 
// * first from to_numbers
//  ) f left outer join
//   ( SELECT 
// *  from second  
//    ) s";res;

$res=   mysqli_query($db,"Select * from first UNION select * from second ");
        echo "<tr><td colspan='5'></td></tr>";
             while($row = mysqli_fetch_assoc($res))  
                               echo '  

Open in new window

 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\third.php on line 22
shruti aAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
[Please use code tags - makes it easier to read - for instance line 22 has meaning - added them for you]

The error is saying that the mysqli_query failed.

Add this after line
$res=   mysqli_query($db,"Select * from first UNION select * from second ");
if (!$res) {
    echo "Query failed with error : " . mysqli_error($db);
else {
   // rest of your code here

Open in new window

EDIT: Fixed typo ($res) - thanks to Jim Riddles for pointing it out

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim RiddlesPrepress/OMS SpecialistCommented:
Julian, you have a typo on line 2...you're missing the "$" in front of res.
Jim RiddlesPrepress/OMS SpecialistCommented:
With no further input from the author, Julian's solution answers the question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.