• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

how to get number of tuples in a table?

      I am trying to find out the number of tuples in a database table and print the number out on a page. Here is what I tried unsuccessfully:

            $test1 = "select @s:=count(*) from job";
            $teststmt1 = OCIParse($conn,$test1);
            echo "eventNumber = $eventNumber \n";

However, I get the following error message: "OCIStmtExecute: ORA-00936: missing expression in...."

how do I print the number of tuples in a table in my database on a php page?
4 Solutions
Muhammad WasifCommented:
Is a tuple another word for record?
 If so, then you can use

//get number of records from result
$numofrecords = mysql_num_rows($result);

//Print number of results
echo $numofrecords;

I didn't know what tuples were, so I did a google search on it and got that it was the same as a record. I may be wrong though.
no jmar,u r correct
touple is used for a record
and kavishshukl,as jamar has said myswl_num_rows(resultset) returns the no of records fetched
Cornelia YoderArtistCommented:
Use the following query:

$test1="SELECT COUNT(*) AS count FROM job";
Cornelia YoderArtistCommented:
It's a fairly trivial thing to do, all the answers were basically correct, just various ways to do the same thing, I'd say divide the points evenly among the respondants.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now