Konstantin Osipov writes:
 > Hi!
 > 
 > Is this code buggy?
 > 
 > ...
 > mysql_res = mysql_store_result(mysql);
 > 
 > if (mysql_errno(mysql) == 0 && mysql_num_rows(mysql_res) > 2 &&
 > mysql_num_fields(mysql_res) > 2)
 > {
 >     MYSQL_ROW row1 = mysql_fetch_row(mysql_res); // can i fetch several rows
 > and then work with them?
 >     MYSQL_ROW row2 = mysql_fetch_row(mysql_res); //
 >     if (row1[0] == row2[0])
 >         printf("equal\n");
 > }
 > 
 > 
 > 


HI!

It is !! Konstantin, you send us a lot of buggy code. Nobody should be
flamboyant with it's buggy code. 

What if mysql_store_result() returned NULL ??

Also, you would do much better by fetching rows like this:

while ((row=mysql_fetch_row(mysql_res)))

Also, again if you use properly MySQL++, without shortcuts (!), you
will be much safer from the errors like the above.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to