note 109144 added to function.mysql-list-fields
| From: | phpflow at gmail dot com | Date: | Fri, 22 Jun 2012 20:32:11 +0000 |
| Subject: | note 109144 added to function.mysql-list-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188762@lists.php.net to get a copy of this message | ||
Below script is used to get all coloumn indormation of an table.When we are working custome ORM then
we need to match the coloumn name with array keys.
function getColoumn($table) {
$result = mysql_query("SHOW COLUMNS FROM ". $table);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
}
$fieldnames=array();
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$fieldnames[] = $row['Field'];
}
}
return $fieldnames;
}
more
<a herf="http://phpflow.com">phpflow.com</a>
----
Server IP: 69.147.83.197
Probable Submitter: 180.188.248.59
----
Manual Page -- http://www.php.net/manual/en/function.mysql-list-fields.php
Edit -- https://master.php.net/note/edit/109144
Del: integrated -- https://master.php.net/note/delete/109144/integrated
Del: useless -- https://master.php.net/note/delete/109144/useless
Del: bad code -- https://master.php.net/note/delete/109144/bad+code
Del: spam -- https://master.php.net/note/delete/109144/spam
Del: non-english -- https://master.php.net/note/delete/109144/non-english
Del: in docs -- https://master.php.net/note/delete/109144/in+docs
Del: other reasons-- https://master.php.net/note/delete/109144
Reject -- https://master.php.net/note/reject/109144
Search -- https://master.php.net/manage/user-notes.php