how to fetch data from oracle database using PHP

后端 未结 2 546
無奈伤痛
無奈伤痛 2021-01-27 01:11

I am trying to create a class for executing oracle sql statements on PHP.

here is my index.php where I am trying to call my function

 

        
相关标签:
2条回答
  • 2021-01-27 01:51

    I would say, first check with your database connectivity, then check, whether it is connected with right database or not ? Check for how many rows is being selected.

    I will recommend you to use show_error() function to validate your database connection.

    0 讨论(0)
  • 2021-01-27 01:53

    The reasons why you are keep getting a blank page are:

    1. $this -> totalRows = oci_num_rows($this -> statement);
    

    oci_num_rows() function does not return the number of selected rows as you might think. It returns number of rows affected by some DML statement(except SELECT statement). So in your case it will always return 0 and as a result of it the condition

    2. if($this -> totalRows > 0) 
    

    evaluates to false and while loop will never be executed.

    Besides, oci_fetch_array() fetches one row at a time or FALSE if there is no more rows to return, so if($this -> totalRows > 0) in your case seems redundant.

    0 讨论(0)
提交回复
热议问题