Can Someone please Help ?? I am asked to pick up the team, teamid, pennants, and worldseries columns from the champs and teamstats tables. and print the number of baseball teams in the champs table. I have 2 files as following. I keep getting warnings saying Warning:mysqli_num_rows()expects parameter 1 to be mysqli_result, null given in /Users/
<?php //FIRST FILE: mysqli_connect.php
DEFINE ('DB_USER', 'happy');
DEFINE ('DB_PASSWORD', 'xxxx');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'baseball_stats');
// Make the connection:
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR
die ('Could not connect to
MySQL: ' . mysqli_connect_error() );
// Set the encoding...
mysqli_set_charset($dbc, 'utf8');
?>
//// SECOND FILE
<?php
require ('a9mysqli_connect.php');
$query = "SELECT t.team AS T, t.team_id AS Ti, c.pennants AS P,
c.worldseries AS W from `teamstats` as t join `champs` as c on
t.team_id = c.team_id;";
$result = @mysqli_query ($dbc, $query);
// Count the number of returned rows:
$num = mysqli_num_rows($result);
//Create an HTML table for displaying the query results:
if ($num > 0) { // If it ran OK, display the records.
echo "<p>There are currently $num baseball teams.</p>";
echo '<table align="center">
<tr>
<td align="left"><b>Team</b></td>
<td align="right"><b>Team ID</b></td>
<td align="right"><b>Pennants </b></td>
<td align="right"><b>WorldSeries </b></td>
</tr>'
;
//Fetch and print each returned record:
while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC)) {
echo '<tr><td align="left">' . $row['T'] . '</td><td align= "left">' .
$row['Ti'] . '</td><td align= "left">' . $row['P'] . '</td><td align=
"left">' . $row['W'] . '</td></tr>';
}
echo '</table>';
mysqli_free_result ($result);
}
else { //If it didnot run OK.
// Public message:
echo '<p class="error"> There are currently no baseball teams in
the database.</p>';
echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $query .
'</p>';
}
mysqli_close($dbc); // Close the database connection.
?>