note 93021 added to mysqli.get-warnings

From: Date: Wed, 19 Aug 2009 21:02:05 +0000
Subject: note 93021 added to mysqli.get-warnings
Groups: php.notes 
Request: Send a blank email to php-notes+get-159657@lists.php.net to get a copy of this message
With a bit of rooting about with reflection, I spotted that the mysqli_warning class has a next() function, so I tried calling it and it does indeed progress through the available warnings! Following on from my earlier example: $r = mysqli_query($db, "INSERT INTO blah SET z = '1'"); $j = mysqli_warning_count($db); if ($j > 0) { $e = mysqli_get_warnings($db); for ($i = 0; $i < $j; $i++) { var_dump($e); $e->next(); } } This is a pretty rubbish interface - it's clearly a kind of half-baked iterable / traversable, but doesn't advertise those interfaces. It's actually more code than doing and processing a SHOW WARNINGS query manually! ---- Server IP: 62.2.182.223 Probable Submitter: 195.43.57.48 ---- Manual Page -- http://www.php.net/manual/en/mysqli.get-warnings.php Edit -- https://master.php.net/note/edit/93021 Del: integrated -- https://master.php.net/note/delete/93021/integrated Del: useless -- https://master.php.net/note/delete/93021/useless Del: bad code -- https://master.php.net/note/delete/93021/bad+code Del: spam -- https://master.php.net/note/delete/93021/spam Del: non-english -- https://master.php.net/note/delete/93021/non-english Del: in docs -- https://master.php.net/note/delete/93021/in+docs Del: other reasons-- https://master.php.net/note/delete/93021 Reject -- https://master.php.net/note/reject/93021 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159657) next »