Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fbsql_num_rows(3) [php man page]

FBSQL_NUM_ROWS(3)							 1							 FBSQL_NUM_ROWS(3)

fbsql_num_rows - Get number of rows in result

SYNOPSIS
int fbsql_num_rows (resource $result) DESCRIPTION
Gets the number of rows in the given $result set. This function is only valid for SELECT statements. To retrieve the number of rows returned from a INSERT, UPDATE or DELETE query, use fbsql_affected_rows(3). PARAMETERS
o $ result -A result identifier returned by fbsql_query(3) or fbsql_db_query(3). RETURN VALUES
Returns the number of rows returned by the last SELECT statement. EXAMPLES
Example #1 fbsql_num_rows(3) example <?php $link = fbsql_connect("localhost", "username", "password"); fbsql_select_db("database", $link); $result = fbsql_query("SELECT * FROM table1;", $link); $num_rows = fbsql_num_rows($result); echo "$num_rows Rows "; ?> SEE ALSO
fbsql_affected_rows(3), fbsql_connect(3), fbsql_select_db(3), fbsql_query(3). PHP Documentation Group FBSQL_NUM_ROWS(3)

Check Out this Related Man Page

FBSQL_DATA_SEEK(3)							 1							FBSQL_DATA_SEEK(3)

fbsql_data_seek - Move internal result pointer

SYNOPSIS
bool fbsql_data_seek (resource $result, int $row_number) DESCRIPTION
Moves the internal row pointer of the FrontBase result associated with the specified result identifier to point to the specified row num- ber. The next call to fbsql_fetch_row(3) would return that row. PARAMETERS
o $ result -A result identifier returned by fbsql_query(3) or fbsql_db_query(3). o $row_number - The row number. Starts at 0. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 fbsql_data_seek(3) example <?php $link = fbsql_pconnect("localhost", "_SYSTEM", "secret") or die("Could not connect"); fbsql_select_db("samp_db") or die("Could not select database"); $query = "SELECT last_name, first_name FROM friends;"; $result = fbsql_query($query) or die("Query failed"); // fetch rows in reverse order for ($i = fbsql_num_rows($result) - 1; $i >=0; $i--) { if (!fbsql_data_seek($result, $i)) { printf("Cannot seek to row %d ", $i); continue; } if (!($row = fbsql_fetch_object($result))) continue; echo $row->last_name . $row->first_name . "<br /> "; } fbsql_free_result($result); ?> PHP Documentation Group FBSQL_DATA_SEEK(3)
Man Page

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Calculating the Number of Rows and Average

Hi All I like to know how can we calculate the number of rows and the average of the values present in the file. I will not know what will be the rowcount, which will be dynamic in nature of the file. eg. 29 33 48 30 28 (6 Replies)
Discussion started by: pk_eee
6 Replies

2. Web Development

How to: IFNULL(SELECT ...,0)

Hi all, Wondering is this possible: SELECT id AS cid, name, phone, url, streettype, IFNULL((SELECT ROUND(AVG(stars)*2, 1) / 2 FROM " . $dbconf{'prefix'} . "reviews WHERE location=cid) AS avgstars,0), ... OR should it be: SELECT id AS cid, name, phone, url, streettype, (SELECT ... (0 Replies)
Discussion started by: STOIE
0 Replies

3. Shell Programming and Scripting

How to replace a string (case insensitive)?

Hi, Please help me in following prob. I have a input file in which UPDATE statements will be present. I need to check the count of the rows impacted by each statement. I am using below code to do so: $dml --> File having UPDATE SQLs like Update <table_name> Set <field>=<value>... (3 Replies)
Discussion started by: ustechie
3 Replies

4. Shell Programming and Scripting

Parse a File ColumnWise & Delete the Rows

Hi , I have a CSV file that has around 50K records in it. I have to delete all the duplicate rows from the file except one, depending upon data in column4. Lets say there are 3 rows for 'column4data' in the file. I have to retain only that line which has the smallest date value in column2.... (3 Replies)
Discussion started by: Sheel
3 Replies

5. Shell Programming and Scripting

Removing Duplicate Rows in a file

Hello I have a file with contents like this... Part1 Field2 Field3 Field4 (line1) Part2 Field2 Field3 Field4 (line2) Part3 Field2 Field3 Field4 (line3) Part1 Field2 Field3 Field4 (line4) Part4 Field2 Field3 Field4 (line5) Part5 Field2 Field3 Field4 (line6) Part2 Field2 Field3 Field4... (7 Replies)
Discussion started by: ekbaazigar
7 Replies