note 71405 added to function.mysql-fetch-assoc

From: Date: Mon, 27 Nov 2006 16:14:18 +0000
Subject: note 71405 added to function.mysql-fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-120102@lists.php.net to get a copy of this message
This is a fetch-function useful while using multiple tables in your query: function sqlf($result){ $row = mysql_fetch_row($result); if($row === FALSE) return FALSE; for ($i = 0; $i < mysql_num_fields($result); $i++) { $meta = mysql_fetch_field($result, $i); $data[$meta ->table . '.' . $meta->name] = $row[$i]; } return $data; } the result will be an array containing fields like this: [table.field] => value ---- Server IP: 212.124.37.9 Probable Submitter: 84.142.33.192 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php Edit -- https://master.php.net/note/edit/71405 Del: integrated -- https://master.php.net/note/delete/71405/integrated Del: useless -- https://master.php.net/note/delete/71405/useless Del: bad code -- https://master.php.net/note/delete/71405/bad+code Del: spam -- https://master.php.net/note/delete/71405/spam Del: non-english -- https://master.php.net/note/delete/71405/non-english Del: in docs -- https://master.php.net/note/delete/71405/in+docs Del: other reasons-- https://master.php.net/note/delete/71405 Reject -- https://master.php.net/note/reject/71405 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120102) next »