dagon wrote:becuause its still a valid query.
....and $result->num_rows tells you the number of rows that were returned (which is why it's called num_rows, I guess).
neridaj wrote:I kept getting an error when trying to implicitly cast.
And the error says .... what? (PHP has no problem implicitly casting integers to strings.)
So how do I get the actual value other than this?
What does the manual say? I know ... let's find out and see (I don't use the MySQLi interface - I don't use MySQL - so this will be a learning experience for me.)
Hm... Vendor-specific database functions ... MySQL ... MySQLi ... ah, [man]MySQLi_Result[/man] class. Hm.... "Get current field offset blahblah" .... "Adjust the result pointer blah" .... oh, this looks good: "mysqli_result::fetch_array — Fetch a result row as an associative, a numeric array, or both". Let's have a look at that...
Lessee... Example 1 looks good. Here's an idea: have a crack at something like this:
$result_array = $result->fetch_array(MYSQLI_NUM);
$count = $result_array[0];