tags:

views:

109

answers:

2

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;
    }
  }
A: 

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.

tbonci
A: 

Have you tried running the query in SQL*Plus using the same connection information (username/password)? Perhaps your user doesn't have any table objects.

LauraB
That query seems to work just fine if I run it through Oracle SQL Developer. :S
Will