根据php sql查询的语法问题给出不同的行数。 请解释

So the title is not real clear so let me try to explain. I am just looking to do a simple sql query using php so that i can then get the number of rows in a table. I was using both the procedural style and the object oriented style checking to see how they work. I thought that they were giving me different results until I noticed that on the procedural styled one I had put a '.' instead of a ';'. If i change the object oriented code to have the period after the num_row call i get the same thing.... So why do i get a one appended to it and not an error?

$row_results=mysqli_query($db_connect, 'SELECT * FROM brands');
$rows=$row_results->num_rows.//right here if I leave a period the result get a 1 appended to it. Why?



$row_result = $db_connect->query('SELECT * FROM brands');
$rows = $row_result->num_rows;

And yes I know that the num_row is object oriented in both examples. I originally thought it was the way i did the query.

Because . is a concatenation (i.e. append) operator?

Also, your idea of counting rows is wrong. A query to count rows in a table have to be

SELECT count(*) FROM brands