MySQL_query problem?
Posted: Tue Mar 20, 2012 4:32 am
Hi all.
can i have a favor to help to recognized the problem below. i was stop from this in just 1 week for this error,
here is the error message, : Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/octagon/public_html/classes/MySQL.php on line 145.
Thank very much.
can i have a favor to help to recognized the problem below. i was stop from this in just 1 week for this error,
Code: Select all
public function ExecuteS($query, $array = true, $use_cache = 1)
{
$this->_result = false;
$this->_lastQuery = $query;
if ($use_cache AND _PS_CACHE_ENABLED_)
if ($array AND ($result = Cache::getInstance()->get(md5($query))))
{
$this->_lastCached = true;
return $result;
}
>>>>>>>>>>>>>>> if ($this->_link && $this->_result = mysql_query($query, $this->_link))[/color]
{
$this->_lastCached = false;
if (_PS_DEBUG_SQL_)
$this->displayMySQLError($query);
if (!$array)
return $this->_result;
$resultArray = array();
// Only SELECT queries and a few others return a valid resource usable with mysql_fetch_assoc
if ($this->_result !== true)
while ($row = mysql_fetch_assoc($this->_result))
$resultArray[] = $row;
if ($use_cache AND _PS_CACHE_ENABLED_)
Cache::getInstance()->setQuery($query, $resultArray);
return $resultArray;
}
if (_PS_DEBUG_SQL_)
$this->displayMySQLError($query);
return false;
}
public function nextRow($result = false)
{
return mysql_fetch_assoc($result ? $result : $this->_result);
}
public function delete($table, $where = false, $limit = false, $use_cache = 1)
{
$this->_result = false;
if ($this->_link)
{
$query = 'DELETE FROM `'.pSQL($table).'`'.($where ? ' WHERE '.$where : '').($limit ? ' LIMIT '.(int)($limit) : '');
$res = mysql_query($query, $this->_link);
if ($use_cache AND _PS_CACHE_ENABLED_)
Cache::getInstance()->deleteQuery($query);
return $res;
}
return false;
}
public function NumRows()
{
if (!$this->_lastCached AND $this->_link AND $this->_result)
{
$nrows = mysql_num_rows($this->_result);
if (_PS_CACHE_ENABLED_)
Cache::getInstance()->setNumRows(md5($this->_lastQuery), $nrows);
return $nrows;
}
elseif (_PS_CACHE_ENABLED_ AND $this->_lastCached)
{
return Cache::getInstance()->getNumRows(md5($this->_lastQuery));
}
}
public function Insert_ID()
{
if ($this->_link)
return mysql_insert_id($this->_link);
return false;
}
public function Affected_Rows()
{
if ($this->_link)
return mysql_affected_rows($this->_link);
return false;
}
protected function q($query, $use_cache = 1)
{
global $webservice_call;
$this->_result = false;
if ($this->_link)
{
$result = mysql_query($query, $this->_link);
$this->_lastQuery = $query;
if ($webservice_call)
$this->displayMySQLError($query);
if ($use_cache AND _PS_CACHE_ENABLED_)
Cache::getInstance()->deleteQuery($query);
return $result;
}
return false;
}
Thank very much.