note 59368 added to function.each

From: Date: Sun, 04 Dec 2005 23:58:57 +0000
Subject: note 59368 added to function.each
Groups: php.notes 
Request: Send a blank email to php-notes+get-99565@lists.php.net to get a copy of this message
To panania at 3ringwebs dot com: If you know for certain that you are only receiving one row, the while becomes redundant. To shorten your code: $strSQL = "SELECT * FROM table WHERE id=1"; $RecordsetSelect = $db->runQuery ($strSQL); list($key, $val) = mysql_fetch_row($RecordsetSelect); echo "$key => $val\n"; mysql_free_result($RecordsetSelect); With only one row being returned this is more elegant a solution, but just being nit-picky in essence. It also shows another quick way of using list. ---- Manual Page -- http://www.php.net/manual/en/function.each.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59368 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59368&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59368&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99565) next »