I try to select mysql data, save them in a two dimensional array and output the data. I get the error message mentioned above for each column and row.
Could someone please point out my mistake. How can I get it to work?
This is the code:
// connect database
$db_connection = new mysqli (MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
// execute query
$query_result = $db_connection->query($sql_career);
// save carrer data
while( $row = $query_result->fetch_assoc() )
{
$career[]['id'] = $row['career_id'];
$career[]['season'] = $row['career_season'];
$career[]['matches'] = $row['career_matches'];
$career[]['goals'] = $row['career_goals'];
$career[]['team_name'] = $row['career_team_name'];
}
// output
echo '<table border="1">';
foreach ($career as $i)
{
echo "<tr>";
echo "<td>". $career[$i]['id'] . "</td>";
echo "<td>". $career[$i]['season'] . "</td>";
echo "<td>". $career[$i]['team_name'] . "</td>";
echo "<td>". $career[$i]['matches'] . "</td>";
echo "<td>". $career[$i]['goals'] . "</td>";
echo "</tr>";
}
echo "</table>";