note 129145 added to pdostatement.fetchcolumn

From: Date: Sat, 06 Jan 2024 09:20:22 +0000
Subject: note 129145 added to pdostatement.fetchcolumn
Groups: php.notes 
Request: Send a blank email to php-notes+get-221099@lists.php.net to get a copy of this message
When migrating from mysqli it is important that while mysqli_result::fetch_column will iterate over subsequent rows PDOStatement::fetchColumn will NOT! <?php while ( $row0 = $db->query("SELECT value FROM bool")->fetchColumn(0) ) { var_dump( $row0 ); } ?> is an endless loop unless the first column in the first row of the table bool is "0". ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 62.112.9.167) ---- Manual Page -- https://php.net/manual/en/pdostatement.fetchcolumn.php Edit -- https://main.php.net/note/edit/129145 Del: integrated -- https://main.php.net/note/delete/129145/integrated Del: useless -- https://main.php.net/note/delete/129145/useless Del: bad code -- https://main.php.net/note/delete/129145/bad+code Del: spam -- https://main.php.net/note/delete/129145/spam Del: non-english -- https://main.php.net/note/delete/129145/non-english Del: in docs -- https://main.php.net/note/delete/129145/in+docs Del: other reasons-- https://main.php.net/note/delete/129145 Reject -- https://main.php.net/note/reject/129145 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221099) next »