note 33047 added to function.mysql-fetch-row
| From: | dsluchin at rack1 dot php dot net | Date: | Sun, 15 Jun 2003 02:44:38 +0000 |
| Subject: | note 33047 added to function.mysql-fetch-row | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50359@lists.php.net to get a copy of this message | ||
In this code:
while($sql_fetch_rows = mysql_fetch_row($sql_query)) {
$info_offset = 1;
$info_columns = 0;
while ($info_offset <= $sql_num_fields) {
$info_elements[$info_rows][$info_columns] = $sql_fetch_rows[$info_columns];
$info_offset++; $info_columns++;
}
$info_rows++;
}
You're making these harder on yourself than they need to be with the including of the
$info_offset variable, which you're always making be ($info_columns + 1). This is cleaner:
while($sql_fetch_rows = mysql_fetch_row($sql_query)) {
$info_columns = 0;
while ($info_columns < $sql_num_fields) {
$info_elements[$info_rows][$info_columns] = sql_fetch_rows[$info_columns] ;
$info_colunns++;
}
$info_rows++ ;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-row.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33047
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33047&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33047&report=yes