note 107008 added to function.mysql-fetch-assoc

From: Date: Wed, 28 Dec 2011 12:10:16 +0000
Subject: note 107008 added to function.mysql-fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-185264@lists.php.net to get a copy of this message
A function to retrieve _all_ fields as fully qualified names: function mysql_fetch_assoc_fullname($r) { // Does the same thing a as mysql_fetch_assoc, but the keys are fully qualified like <table name>.<field name>. // That way all fields is perserved and adressable like mysql_fetch_row is. // table name will be blank if its a computed field. F.ex: 'select 5+5 as ten' will give array('.ten' => 10) $f = mysql_fetch_row($r); if($f === false) return false; $tmp = array(); foreach($f as $k => $v) { $tmp[mysql_field_table($r, $k) . '.' . mysql_field_name($r, $k)] = $v; } return $tmp; } ---- Server IP: 69.147.83.197 Probable Submitter: 80.232.111.161 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php Edit -- https://master.php.net/note/edit/107008 Del: integrated -- https://master.php.net/note/delete/107008/integrated Del: useless -- https://master.php.net/note/delete/107008/useless Del: bad code -- https://master.php.net/note/delete/107008/bad+code Del: spam -- https://master.php.net/note/delete/107008/spam Del: non-english -- https://master.php.net/note/delete/107008/non-english Del: in docs -- https://master.php.net/note/delete/107008/in+docs Del: other reasons-- https://master.php.net/note/delete/107008 Reject -- https://master.php.net/note/reject/107008 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185264) next »