Issue Bug Closed

#16322Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ...

edwin 07/05/06, 10:43 updated 11/22/11, 14:47

Description

Because there is nothing in the database which can be selected througth the select statement, made by exec_SELECTquery(). Than there is nothing to sql_fetch_assoc() so you get an error. Problem can be sloved by useing the @-sign. I report this because i’ve seen more functions where the same problem can be found.

I’ve found the problem in t3lib\class.t3lib_page.php getHash($hash,$expTime=0)

$res = $GLOBALS[‘TYPO3_DB’]->exec_SELECTquery(‘content’, ‘cache_hash’, ‘hash=’.$GLOBALS[‘TYPO3_DB’]->fullQuoteStr($hash, ‘cache_hash’).$whereAdd);
if ($row = $GLOBALS[‘TYPO3_DB’]->sql_fetch_assoc($res)) {
$GLOBALS[‘TYPO3_DB’]->sql_free_result($res);
return $row[‘content’];
}

i’ve also another question, what is happening if $row = $GLOBALS[‘TYPO3_DB’]->sql_fetch_assoc($res) is false? Than nothing is returned.
(issue imported from #M3794)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.