dqx36753 2010-10-27 14:08
浏览 22
已采纳

我甚至连接到Oracle?

When I attempt this query:

$query = "SELECT * FROM user_objects WHERE object_type = 'TABLE'";

... I get an empty result set.

I have error_reporting() set to E_ALL, so I would assume that if it wasn't connecting correctly, I would be getting an error... right?

I'm using a class given to me by a higher-up that they use for everything, so it SHOULD work.

If you want that code, let me know.

Thanks for any help you guys can give me :).

EDIT

Here's the actual query function being executed:

/**
   * Query the database and store the result.  If the query is a select it returns the number of rows
   * fetched.
   *
   * Example:
   * <code>
   * $query = "SELECT * FROM tablename";
   * if($sql->query($query)){
   *  while($sql->fetch()){
   *      foreach($sql->results as $a=>$b){
   *        print "$a: $b<br>";
   *      }
   *      print "<hr>";
   *    }
   * }else{
   *    print "No results";
   * }
   *
   * </code>
   *
   * @param SQL*Plus query statement
   * @access public
   * @return int
   */
  function query($query_statement){
      if($_SESSION['TESTING']==1 && $_SESSION){
        $_SESSION['queries'][] = $query_statement;
        $_SESSION['Total_queries'] = count($_SESSION['queries']);
      }
    $parse_result = $this->execute($query_statement);
    if($parse_result == 0){
      return 0;
    }else{
      if($this->_queryresult){
        oci_free_statement($this->_queryresult);
      }
      $this->results=array();
      $this->_queryresult = $parse_result;
      $this->resultscount = oci_num_rows($this->_queryresult);
      if(!$this->resultscount)
        return 0;
      else
        return $this->resultscount;
    }
  }
  • 写回答

2条回答 默认 最新

  • duandian8251 2010-10-27 14:12
    关注

    You might want to make sure you display the errors, you can force one to check. You could also check the return value of the connect statement before you attempt to query.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器