note 33047 deleted from function.mysql-fetch-row by philip

From: Date: Mon, 26 Feb 2007 06:55:57 +0000
Subject: note 33047 deleted from function.mysql-fetch-row by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123874@lists.php.net to get a copy of this message
Note Submitter: dsluchin at ya hoo dot com ---- 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++ ; }

« previous php.notes (#123874) next »