Displaying the search data in database MySQL
<p>How can I display the data that I search in the MySQL?</p>

<p>I tried this code but it always give me an error of :</p>

<blockquote>
  <p>"Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\FindFriend\resultFindFriend.php on line 12"</p>
</blockquote>

<pre><code>&lt;?php

if(!isset($_POST['dataFriend'])){
    echo("no result");

}else {

    $find = $_POST['dataFriend'];
    $con = mysqli_connect('127.0.0.1','root','','test');
    $queryFindFriend = "SELECT fullname FROM members WHERE fullname LIKE '%".$find."%'";
    $friendResult = mysqli_query($con, $queryFindFriend);
    $rows = mysqli_fetch_assoc($friendResult);
    foreach($rows as $row)
    {
    ?&gt;
        &lt;div class="outputfindfriend"&gt;
        &lt;?php echo $row;?&gt;
        &lt;/div&gt;
    &lt;?php
    }   
}
?&gt;
</code></pre>
