Versions available for this page: CUBRID 8.2.1 | CUBRID 8.3.0 | CUBRID 8.3.1 | CUBRID 8.4.0 | CUBRID 8.4.1 |
The cubrid_num_rows() function is used to return the number of rows in the query result. This is available only with the SELECT statement. Use cubrid_affected_rows() if you want to know the results of INSERT, UPDATE and DELETE queries. cubrid_num_rows() can be used only with synchronous queries. It returns 0 if the query is asynchronous.
int cubrid_num_rows (resource $request)
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$req = cubrid_execute($conn, "SELECT * FROM code");
$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);
printf("Row Num: %d\nColumn Num: %d\n", $row_num, $col_num);
cubrid_disconnect($conn);
?>
The above example will output:
Row Num: 6
Column Num: 2