Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

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 | 



cubrid_num_rows

Description

The cubrid_num_rows function returns 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.

Syntax

int cubrid_num_rows (resource $req_identifier)

  • req_identifier : Request identifier
Return Value
  • Success : The number of rows
  • Asynchronous query : 0
  • Failure : -1
Example

<?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 Column Num: %d ", $row_num, $col_num);

 

cubrid_disconnect($conn);

?>

 

The above example will output:

 

Row Num: 6

Column Num: 2

See Also