I'm trying to write the output of a MySQL select into a variable. The problem is that i get the error "Array to String conversion".
$user = mysql_query("select username from user");
echo "<table border='1'>";
if (isset($_POST['winneron'])) {
echo "<tr>";
while ($printuser = mysql_fetch_array($user)) {
echo "<th align='center'>". $printuser['username'] . "</th>";
}
echo "</tr>";
$user = mysql_query("select username from user");
while ($printuser = mysql_fetch_array($user)) {
$games = mysql_query("SELECT s.spielid, date, team1, team2, sieger, wettid, u.userid, w.spielid, team
FROM user u, spiele s, wette w
WHERE u.userid = w.userid
AND u.username = '$printuser'
AND w.spielid = s.spielid"); <-- Error line
while ($printgames = mysql_fetch_array($games)) {
if ( $printgames['sieger'] == $printgames['team1'] ) {
echo "<tr><td align='center'><b>". strtoupper($printgames['sieger']) . "</b></td></tr>";
}
else {
echo "<tr><td align='center'>". strtoupper($printgames['sieger']) . "</td></tr>";
}
}
}
}