#26411 [NEW]: while {} else {}
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
Thread (28 messages)
- php at bellytime dot com
- elmicha@php.net#26411 [Opn->Fbk]: while {} else {}
- helly@php.net#26411 [Fbk]: while {} else {}
- elmicha@php.net#26411 [Fbk->Opn]: while {} else {}
- ois at oisnot dot com#26411 [Com]: while {} else {}
- trefighter2334 at aol dot comReq #26411 [Com]: while {} else {}
- ijrbiz at gmail dot comReq #26411 [Com]: while {} else {}
- absimu at hotmail dot comReq #26411 [Com]: while {} else {}
- hawkyhawk14 at gmail dot comReq #26411 [Com]: while {} else {}
- ma-martin at hotmail dot deReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- laruence@php.netReq #26411 [Opn->Wfx]: while {} else {}
- nikic@php.netReq #26411 [Wfx->Opn]: while {} else {}
- hawkyhawk14 at gmail dot comReq #26411 [Com]: while {} else {}
- nikic@php.netReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- rasmus@php.netReq #26411 [Opn]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- kjarli at gmail dot comReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- sebi at max-vision dot roReq #26411 [Com]: while {} else {}
- nikic@php.netReq #26411 [Opn->Wfx]: while {} else {}
- asd at asd dot asdReq #26411 [Com]: while {} else {}
- rageclick at gmail dot comReq #26411 [Com]: while {} else {}
- php at pointpro dot nlReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}
- bensor987 at neuf dot frReq #26411 [Com]: while {} else {}