Query returns in procedural but not OOP
Posted: Thu Sep 07, 2006 4:21 pm
Ok, I am totally missing what is happening here. This works without incident...
However, when I run that same query ($sql) through my class, I get an error returned:
Code: Select all
$sql = 'sp_help';
if ( !$result = sybase_query($sql, $link) )
{
die('Could not show the tables: ' . sybase_get_last_message());
}
echo 'We have selected the tables!';Here is the code for my query processor. What am I doing wrong?Warning: sybase_query(): supplied argument is not a valid Sybase-Link resource in /path/to/page.php on line 197
Could not run procedure_name: ct_connect(): directory service layer: internal directory control layer error: Requested server name not found. on line 39
Code: Select all
/**
* Sends a database query to the DB server
*
* @param string $query
* @param boolean $transacting
*/
function db_query($query = '', $transacting = false)
{
// If there is an existing result, smack it down like a dog
unset($this->query_result);
// If the query is not empty, try to execute it
if ( !empty($query) )
{
// Lets increment out query counter (Geek Feature
$this->query_count++;
// Lets time the query (Some geek, some necessity)
$start_time = $this->db_set_timer();
$this->query_result = sybase_query($query, $this->db_link_id);
$stop_time = $this->db_set_timer();
// Actually increment the total query time
$this->db_time_query($start_time, $stop_time);
}
// If we received a clean return from the database
if ( isset($this->query_result) )
{
// Return it
return $this->query_result;
}/*
else
{
// Otherwise, check if we are in a transaction
return ( $transacting == 2 ) ? true : false;
}*/
}