From:             php at bellytime dot com
Operating system: FreeBSD
PHP version:      Irrelevant
PHP Bug Type:     Feature/Change Request
Bug description:  while {} else {}

Description:
------------
How about a while...else structure. Often we do 

if (!mysql_num_rows($result)) {
   print 'No results found';
}
while ($row = mysql_fetch_assoc($result)) {
   print 'Here is a result';
   ...
}

Wouldn't it be nicer to do a 

while ($row = mysql_fetch_assoc($result)) {
   print 'Here is a result';
   ...
} else {
   print 'No results found';
}



-- 
Edit bug report at http://bugs.php.net/?id=26411&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26411&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26411&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26411&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26411&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26411&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26411&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26411&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26411&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26411&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26411&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26411&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26411&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26411&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26411&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26411&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26411&r=float

Reply via email to