Member Avatar for Rahul47

Here is my snippet for which am trying to understnad output of var_dump().

echo "<br> <br> Part2: ";
$query1="select * from student";
$result=mysqli_query($con,$query1) or die(mysqli_error($con));
var_dump($result);
if ($result)
{
    $num1=mysqli_num_rows($result);
    var_dump($num1);
    echo $num1." rows affected.";
}

OUTPUT:

d13507ba3998569ccd8376c851b1d753

<---- Any explanation for this output?

Am not sure what needs explaining. The result returned by a mysqli_query is a result object.

Member Avatar for Rahul47

Why are all the identifiers set to null ?

It gets it's values after a fetch or seek.

Member Avatar for Rahul47

Wasn't num_rows supposed to contain number of rows affected ?

Not necessarily. If it did, there would be no need for the mysqli_num_rows function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.