Kann jemand bitte Hilfe ?? Ich werde gebeten, die Team-, Teamid-, Wimpel- und Worldseries-Spalten aus den Tabellen champs und teampstats zu übernehmen. und drucken Sie die Anzahl der Baseballteams in der Champs-Tabelle aus. Ich habe 2 Dateien wie folgt. Ich erhalte Warnungen sagen Warnung: mysqli_num_rows() erwartet 1 Parameter in/Users/Warnung: mysqli_num_rows() erwartet, dass Parameter 1 mysqli_result ist, null 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.
?>
Possible Duplikat [Mysqli \ _fetch \ _array()/Mysqli \ _fetch \ _assoc()/Mysqli \ _fetch \ _row() erwartet Parameter 1 Ressource oder Mysqli \ _result, boolean gegeben werden] (http: //stackoverflow.com/questions/2973202/mysqli-fetch-array-mysqli-fetch-assoc-mysqli-fetch-row-expects-parameter-1) –
warum '@mysqli_query (' und nicht 'mysqli_query (' –
Ihre Query fehlgeschlagen, debuggen – nogad