MySQL 5.7 C API Developer Guide
my_ulonglong mysql_stmt_num_rows(MYSQL_STMT *stmt)
Returns the number of rows in the result set.
          The use of
          mysql_stmt_num_rows() depends
          on whether you used
          mysql_stmt_store_result() to
          buffer the entire result set in the statement handler. If you
          use mysql_stmt_store_result(),
          mysql_stmt_num_rows() may be
          called immediately. Otherwise, the row count is unavailable
          unless you count the rows as you fetch them.
        
          mysql_stmt_num_rows() is
          intended for use with statements that return a result set,
          such as SELECT. For statements
          such as INSERT,
          UPDATE, or
          DELETE, the number of affected
          rows can be obtained with
          mysql_stmt_affected_rows().