Re: [PHP-DB]how to handle exception in php

[email protected] (Chris)
Newsgroups php.db
Message-ID <[email protected]>
On 02/05/10 15:26, Bavithra R wrote:
> hi friends
>
> I am doing a simple student mark details project.
> for calculating rank I need to compare the total marks one by one.
> To do so i use *for loop.* so atlast while reaching the end of the table it
> shows the following warning.
> *
> Warning*: mysql_result()
> [function.mysql-result<http://127.0.0.1/pro/function.mysql-result>]:
> Unable to jump to row 18 on MySQL result index on line *50*
>
> It is because it has no next value to compare.How to use try..catch
> exception handling in this.?Or any other suggestion.
> Can anybody help me

This isn't an exception, so a try catch won't work. (Exceptions are 
fatal and would say something like "uncaught exception ...").

This is a warning about trying to read something that doesn't exist from 
mysql.

I'd do something like

$query = "select blah";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
   echo "do stuff here";
}

-- 
Postgresql & php tutorials
http://www.designmagick.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.