Platon Technologies
neprihlásený Prihlásiť Registrácia
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 30. november 2021
O nás
Otvorený softvér
Index  »  Projekty  »  phpMyEdit  »  Dokumentácia  »  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
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov