note 35043 added to function.mysql-field-flags
| From: | amir at scrounch dot com | Date: | Sun, 17 Aug 2003 15:39:38 +0000 |
| Subject: | note 35043 added to function.mysql-field-flags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54539@lists.php.net to get a copy of this message | ||
returns primary keys of a table using 'show keys'
although it is possible to use desc, show keys offers possible enhancements such a getting sequence
in index along with it
function getPrimaryKeyOf($table, $link) {
$pk = Array();
$sql = 'SHOW KEYS FROM
'.$table.'';
$res = mysql_query($table, $link) or die(mysql_error());
while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
if ($row[Key_name]=='PRIMARY')
array_push($pk, $row[Column_name]);
}
return $pk;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-field-flags.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35043
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35043&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35043&report=yes