note 114223 added to class.mysqli-result

From: Date: Sun, 26 Jan 2014 16:50:54 +0000
Subject: note 114223 added to class.mysqli-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-198354@lists.php.net to get a copy of this message
An "mysqli_result" function where $field can be like table_name.field_name with alias or not. <?php function mysqli_result($result,$row,$field=0) { if ($result===false) return false; if ($row>=mysqli_num_rows($result)) return false; if (is_string($field) && !(strpos($field,".")===false)) { $t_field=explode(".",$field); $field=-1; $t_fields=mysqli_fetch_fields($result); for ($id=0;$id<mysqli_num_fields($result);$id++) { if ($t_fields[$id]->table==$t_field[0] && $t_fields[$id]->name==$t_field[1]) { $field=$id; break; } } if ($field==-1) return false; } mysqli_data_seek($result,$row); $line=mysqli_fetch_array($result); return isset($line[$field])?$line[$field]:false; } ?> ---- Server IP: 195.221.21.36 Probable Submitter: 88.176.116.17 ---- Manual Page -- http://php.net/manual/en/class.mysqli-result.php Edit -- https://master.php.net/note/edit/114223 Del: integrated -- https://master.php.net/note/delete/114223/integrated Del: useless -- https://master.php.net/note/delete/114223/useless Del: bad code -- https://master.php.net/note/delete/114223/bad+code Del: spam -- https://master.php.net/note/delete/114223/spam Del: non-english -- https://master.php.net/note/delete/114223/non-english Del: in docs -- https://master.php.net/note/delete/114223/in+docs Del: other reasons-- https://master.php.net/note/delete/114223 Reject -- https://master.php.net/note/reject/114223 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198354) next »