Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 499

Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 506

Warning: Incorrect key file for table './miphpf_miphpfcom/watchdog.MYI'; try to repair it query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.', 2, '', 'http://www.miphpf.com/manual/sqlcomplexpkrecord.html', '', '3.145.130.31', 1714065586) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
miSqlComplexPKRecord | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

miSqlComplexPKRecord

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.

Like the miSqlRecord class, miSqlComplexPKRecord is purposed to read, insert, update and delete records from the database. miSqlComplexPKRecord is used when the programmer needs to manage records in a table, where primary key is defined by more than one column.

* Reading a record by primary key example:

<?php
$record
= new miSqlComplexPKRecord('Reciepts', array('OrderID', 'InvoiceID'));
$record->readPK(array('OrderID' => 3, 'InvoiceID' => 4));
?>

* Inserting new record example: Unlike miSqlRecord, here the insert() method will not return the primary key.
<?php
$record
= new miSqlComplexPKRecord('Receipts', array('OrderID', 'InvoiceID'));
$record->set('OrderID', 3);
$record->set('InvoiceID', 4);
$record->set('ReceiptsCreateTime', time());

$record->insert();
?>

* Updating a record example:
<?php
$record
= new miSqlComplexPKRecord('Receipts', array('OrderID', 'InvoiceID'));
$record->set('OrderID', 3);
$record->set('InvoiceID', 4);
$record->set('ReceiptLastUpdate', time());

$record->update();
?>

The following example is also a valid approach:
<?php
$record
= new miSqlComplexPKRecord('Receipts', array('OrderID', 'InvoiceID'));
$record->readPK(array('OrderID' => 3, 'InvoiceID' => 4));
$record->set('ReceiptsLastUpdate', time());

$record->update();
?>

* Deleting a record example:
<?php
$record
= new miSqlComplexPKRecord('Receipts', array('OrderID', 'InvoiceID'));
$record->set('OrderID', 3);
$record->set('InvoiceID', 4);

$record->delete();
?>