Platon Technologies
not logged in Login Registration
open source software development celebrating 10 years of open source development! Wednesday, June 29, 2022
About Us
Open Source
Index  »  Projects  »  phpMyEdit  »  Documentation  »  HTML  »  Unique key

3.2. Unique key

Assuming that 'id' is the name of the MySQL column selected as the unique identifier when phpMyEditSetup.php script was run, the key will appear in the script as:

Example 3-3. Unique key definition

// Name of field which is the unique key
$opts['key'] = 'id';


There were problems reported by phpMyEdit users regarding the usage of MySQL reserved word as an unique key name (the example for this is "key" name). Thus we recommend using another name of unique key. Usage of "id" or "ID" names should be safe and good idea.

The column type for the unique numeric identifier should appear as:

Example 3-4. Unique key type definition

// Type of key field (int, real, string, date, etc.)
$opts['key_type'] = 'int';

The argument 'int' shown above indicates the column type is an integer. If the column type was a date then 'date' would appear above instead of 'int'. Other possible unique key types are 'real' or 'string'.


If you are using 'real' key type and some problems with record manipulaton have occured, it is probably because your MySQL key datatype is 'float'. Comparsions with this datatype is a common problem in most computer languages (including SQL), because floating-point values are not exact values. In most cases, changing the MySQL datatype from 'float' to 'double' and preserving 'real' as phpMyEdit key type should solve this problem.

For more information about this issue, read Solving Problems with No Matching Rows chapter in the MySQL manual (in version 3.23.47 it was A.5.6).

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy