Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6623175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:30:07+00:00 2026-05-25T21:30:07+00:00

I have this problem whereby I cannot display records from oracle database to my

  • 0

I have this problem whereby I cannot display records from oracle database to my web application using PHP as a server side scripting language.Could someone kindly tell me where I could be doing wrong? I want by the end of the day to be able to achieve pagination and replace ROWNUM and rnum with variables that users can manipulate when moving fromm page to page.

     <?php  

    /* Connection string to Oracle view */  
    /* user is patients */  
    /* password is patients */  
    $conn=oci_connect('patients','patients','192.168.1.100/hosecare');  

    /* Query expected to do pagination and get records */  
    $qry="select *  
    from (select a.*, ROWNUM rnum  
    from (select BILL_NO,AK_NO,PAT_NAME,VOUCHER_DATE,USER_NAME,PAYMENT_AMT from patients    WHERE VOUCHER_DATE >='01-Sep-2011' AND VOUCHER_DATE <='26-Sep-2011' AND  SOURCE_LOCATION='KIAMBU CLINIC' ORDER BY VOUCHER_DATE)a
    where ROWNUM <=20)  
    where rnum >=10;";  


    $stid=oci_parse($conn,$qry);  
    oci_execute($stid);  

    /* Table begins here */  
    echo "<table border='1'>\n";  
    echo "<tr>\n";  

    /* Table Column headers */  
    echo "<td>".'<h3>BILL NO</h3>'."</td>";  
    echo "<td>".'<h3>ACCOUNT NO</h3>'."</td>";  
    echo "<td>".'<h3>PATIENT NAME</h3>'."</td>";  
    echo "<td>".'<h3>VOUCHER DATE</h3>'."</td>";  
    echo "<td>".'<h3>USER NAME</h3>'."</td>";  
    echo "<td>".'<h3>PAYMENT AMOUNT</h3>'."</td>";  
    echo "</tr>\n";  

    /* Populating Table cells with records resulting from the pagination query */  
     while($row=oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS)) {  
    echo "<tr>\n";  
    foreach($row as $item){  
            echo "<td>".($item !==null ? htmlentities($item,ENT_QUOTES) :  "&nbsp;")."    </td>\n";
    }
    echo "</tr>\n";
    }

    echo "</table>\n";

    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:30:08+00:00Added an answer on May 25, 2026 at 9:30 pm

    I realized the problem came about because of the preceding unnecessary space before SOURCE_LOCATION in the query and the unnecessary semicolon (;) at the end of the query.

    The code perfectly works the way I wanted.Thanks to each and everyone of you for the contribution you made towards giving Answers to the Question.

    I appreciate all your efforts.

    The working code now looks as follows;

           <?php
    
            //Connection string to Oracle view
            //user is patients
            //password is patients
            $conn=oci_connect('patients','patients','192.168.1.100/hosecare');
            //Query expected to do pagination and get records
    
            //$page will vary depending on which page the user has accessed.
    
            $page=1;
            $pageSize=20;
            $maxrowfetch=(($page * $pageSize) + 1);
            $minrowfetch=((($page - 1) * $pageSize) + 1);
    
            //QUERY WORKING...MODIFIED TO FIT USER REQUIREMENTS
            $qry="select * 
            from (select a.*, ROWNUM rnum
            from (select BILL_NO,AK_NO,PAT_NAME,VOUCHER_DATE,USER_NAME,PAYMENT_AMT from smart WHERE VOUCHER_DATE >='20-Sep-2011' AND VOUCHER_DATE <='26-Sep-2011' AND SOURCE_LOCATION='KIAMBU CLINIC' ORDER BY BILL_NO ASC)a
            where ROWNUM <="."$maxrowfetch".")
            where rnum >="."$minrowfetch"."";
    
    
            //QUERY NOT WORKING...THE 2 SPACES BEFORE SOURCE_LOCATION IN THE QUERY WAS THE PROBLEM
            /***
            $qry="select * 
            from (select a.*, ROWNUM rnum
            from (select BILL_NO,AK_NO,PAT_NAME,VOUCHER_DATE,USER_NAME,PAYMENT_AMT from patients WHERE VOUCHER_DATE >='01-Sep-2011' AND VOUCHER_DATE <='26-Sep-2011' AND  SOURCE_LOCATION='KIAMBU CLINIC' ORDER BY VOUCHER_DATE ASC)a
            where ROWNUM <=20)
            where rnum >=10";
            ***/
    
    
            //QUERY WORKING...1 SPACE BEFORE SOURCE_LOCATION IN QUERY
            /***
            $qry="select * 
            from (select a.*, ROWNUM rnum
            from (select BILL_NO,AK_NO,PAT_NAME,VOUCHER_DATE,USER_NAME,PAYMENT_AMT from patients WHERE VOUCHER_DATE >='01-Sep-2011' AND VOUCHER_DATE <='26-Sep-2011' AND  SOURCE_LOCATION='KIAMBU CLINIC' ORDER BY VOUCHER_DATE ASC)a
            where ROWNUM <=20)
            where rnum >=10";
            ***/
    
    
            $stid=oci_parse($conn,$qry);
            oci_execute($stid);
    
            //Table begins here
            echo "<table border='1'>\n";
            echo "<tr>\n";
    
            //Table Column headers
            echo "<td>".'<h3>BILL NO</h3>'."</td>";
            echo "<td>".'<h3>ACCOUNT NO</h3>'."</td>";
            echo "<td>".'<h3>PATIENT NAME</h3>'."</td>";
            echo "<td>".'<h3>VOUCHER DATE</h3>'."</td>";
            echo "<td>".'<h3>USER NAME</h3>'."</td>";
            echo "<td>".'<h3>PAYMENT AMOUNT</h3>'."</td>";
            echo "</tr>\n";
    
            //Populating Table cells with records resulting from the pagination query
            while($row=oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS)) {
            echo "<tr>\n";
    
    
                echo "<td>";
                echo $row["BILL_NO"];
                echo "</td>";
                echo "<td>";
                echo $row["AK_NO"];
                echo "</td>";
                echo "<td>";
                echo $row["PAT_NAME"];
                echo "</td>";
                echo "<td>";
                echo $row["VOUCHER_DATE"];
                echo "</td>";
                echo "<td>";
                echo $row["USER_NAME"];
                echo "</td>";
                echo "<td>";
                echo $row["PAYMENT_AMT"];
                echo "</td>";
                echo "</tr>";
    
    
            }
    
            echo "</table>\n";
    
            echo "MAX ROW FETCH ".$maxrowfetch."<br>";
            echo "MIN ROW FETCH ".$minrowfetch."<br>";
            echo $qry."<br>";
    
             ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem whereby, i have created a user defined function within php.
I have this problem in my ASP.NET application where I'm seeing some of my
I have a requirement for an ASP.NET web application whereby the same user is
We have a problem in one of our web apps whereby a null reference
I have an application whereby I dynamically create controls on a form from a
I have a SQLite database that I wish to read records from and execute
We have an issue whereby we are using this code below. Its just a
I have this problem I'm hoping someone knows the answer to. I have an
I have this problem where I open Visual Studio and the internal windows are
i have this problem to find a particular xml node l have post this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.