View Single Post
Old 02-01-2013, 07:49 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Is that supposed to be $result or is it supposed to be $res?
It also cannot be used quite this way. A single call to a fetch function increments the resultset pointer to the next row. So each fetch would move the pointer one more row, which depending on the number of results would return null (which would throw the same error you have as well) when it hits the last record. You need to capture a single call to the fetch and then check that one for what it has within it.

There is no directly comparable function to mysql_result from what I can see. You need to fetch the record in its entirety and offset the returned array offset or object property to use it.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote