how to get number of tuples in a table?

Posted on 2006-05-09
Last Modified: 2013-12-12
      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?
Question by:kavishshukla
    LVL 20

    Accepted Solution

    LVL 3

    Assisted Solution

    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.
    LVL 8

    Assisted Solution

    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
    LVL 27

    Assisted Solution

    Use the following query:

    $test1="SELECT COUNT(*) AS count FROM job";
    LVL 27

    Expert Comment

    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

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now