note 26885 added to function.odbc-fetch-into
| From: | PHP at TeamBurke dot com dot NoSpam | Date: | Sat, 16 Nov 2002 02:00:20 +0000 |
| Subject: | note 26885 added to function.odbc-fetch-into | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39557@lists.php.net to get a copy of this message | ||
DON'T START AT ROW 0
When using odbc_fetch_into($id,$row_num,$array) don't intialize the $row_num=0.
Why... well if you do this and you have one record in the table you'll get an error... not a
problem. BUT, if you have more than one row in the table, there is no error and the first record in
the table is lost.
This may seem obvious, but remember that we count many things starting from 0, so doing it here made
sense in my mind. Took quite some time to solve the problem, because I had used the same method on
another page, where there were multiple row records, and that page worked fine. I just never
noticed that it failed to print the first record's information. So you can imagine my
puzzlement when the code worked on one page and not the next.
--
http://www.php.net/manual/en/function.odbc-fetch-into.php
http://master.php.net/manage/user-notes.php?action=edit+26885
http://master.php.net/manage/user-notes.php?action=delete+26885
http://master.php.net/manage/user-notes.php?action=reject+26885