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.
header('HTTP/1.1 420 Enhance Your Calm');