Greetings, the following code:
$usertr = mysql_query("SELECT * FROM allurlszhhk"); $rowtr = mysql_fetch_array($usertr); $count = count($rowtr); echo $count ; displays 6 when the fields in the database are 275
mysql_fetch_array returns one row of data. To count the number of records in a table, you can use
$res = mysql_query("SELECT COUNT(*) FROM table_name"); $row = mysql_fetch_row($res); $total = $row[0]; echo $total; mysql_num_rows ? - user207618mysql_num_rows then we will select all the data and then calculate them. And if the table is not 275 lines, but several millions? - Mihanik71mysql_* , only with PDO . - user207618rowCount first executes the query, and then it counts the rows - Mihanik71Source: https://ru.stackoverflow.com/questions/621918/
All Articles
mysql_fetch_arrayreturns the next entry, and not all at once, is it not? And there are six fields coming out. - user207618