Primary Columns

CrudKit relies on a primary key to identify a row in your database. Currently it’s tested with integer primary keys, but will add support for other columns as well. However it is unlikely to work without support for a primary key.

To do this, use the setPrimaryKey or the setPrimaryKeyWithId function.

<?php

$mysql_page->setPrimaryKey ("CustomerId", "Customer Id", array());
// or 
$mysql_page->setPrimaryKeyWithId ("cid", "CustomerId", "Customer Id", array());
?>

Both functions do very similar functionality, but the benefit of using setPrimaryKeyWithId is that the client side won’t ever see your column name. The parameters are:

  1. The ID - an alphanumeric string, used to represent the column. (only if you use setPrimaryKeyWithId)
  2. The column name in the database table.
  3. The human friendly name to be displayed on forms, etc.
  4. Array of options

Optional parameters

Currently, no optional parameters are supported for setPrimaryKey

Built by Anirudh Sanjeev. CrudKit is distributed under the MIT/X11 License.