note 99160 added to function.mysql-fetch-field

From: Date: Sat, 31 Jul 2010 00:45:35 +0000
Subject: note 99160 added to function.mysql-fetch-field
Groups: php.notes 
Request: Send a blank email to php-notes+get-171278@lists.php.net to get a copy of this message
It should be noted that the primary_key member variable is only set to 1 if the primary key on the table is only on that 1 field. If you have a table that has a multiple column primary key, then you will not get what you might expect. For example: CREATE TABLE line_item_table ( liForeignKey1 int(11) unsigned not null, liForeignKey2 int(11) unsigned not null, PRIMARY KEY (liForeignKey1, liForeignKey2) ) ENGINE=MyISAM; While you might expect that primary_key == 1 for both columns; var_dump() will show you that you get the following for both fields: ["primary_key"]=>int(0) This is as of PHP 5.2.13 and MySQL 5.0.51 ---- Server IP: 69.147.83.197 Probable Submitter: 67.171.160.131 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-field.php Edit -- https://master.php.net/note/edit/99160 Del: integrated -- https://master.php.net/note/delete/99160/integrated Del: useless -- https://master.php.net/note/delete/99160/useless Del: bad code -- https://master.php.net/note/delete/99160/bad+code Del: spam -- https://master.php.net/note/delete/99160/spam Del: non-english -- https://master.php.net/note/delete/99160/non-english Del: in docs -- https://master.php.net/note/delete/99160/in+docs Del: other reasons-- https://master.php.net/note/delete/99160 Reject -- https://master.php.net/note/reject/99160 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171278) next »