This PHP code is for cheking for names who user is following.They are his friends or if they are not his $friends must show <td> <input type="submit" id="downloadbut" value="Follow"></td>
if there are his $friends must show echo '<td> <span id="liketextvote">Following</span></td>';
if the user is following them. But my problem is I can't get result for $friends. The problem is
Notice: Array to string conversion in C:\xampp\htdocs\Edu\1111111111111\userinfo.php on line 109 Array
. But inside while loop result is: megiantongeorgekatimery - this is example from MySQL database. I don't have idei how can I get this results. Someone can help?
$userfile = $_GET['username'];
$username = $user_data['username'];
if ($username != $userfile) {
$addfriends = mysql_query("SELECT `follow` FROM `friends` WHERE `username` = '$username' ORDER BY id DESC");
$friends = array();
while ($query_row = mysql_fetch_array($addfriends)) {
$val = $query_row['follow'];
echo $val; // hier I can get result example five name megiantongeorgekatimery
$friends[] = $val;
}
echo $friends; // hier I can get result example five name megiantongeorgekatimery
if (!in_array($userfile, $friends)) {
echo '<form action="addfriends.php?username='.$userfile.'" method="post">
<td> <input type="submit" id="downloadbut" value="Follow"></td>
</form>';
} else {
echo '<td> <span id="liketextvote">Following</span></td>';
}
}