Tech Blog

Charged Items for Location

  • Author: Ken Herold
  • Additional author(s):
  • Institution:
  • Year: 2008
  • License: BSD style
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: Detailed license terms
  • Skill required for using this code:
    Choose one of the following: basic, intermediate, technical. Please also add your choice as a tag at the bottom of the page.


Displays materials currently circulated by a Small Collection (Location)



Screen captures

See working example.

Working example

Installation instructions

See authentication in require statement.

<Code sample>
// This include file contains the logon username, password, and database name
// Connect to the database by passing logon information
// Define your query in SQL
$query = "
           bib_text.bib_id, bib_text.title,,
           item_barcode.item_id, item_barcode.item_barcode,
           bib_item.bib_id, bib_item.item_id,
           circ_transactions.charge_location, circ_transactions.charge_date,
           circ_transactions.item_id, circ_transactions.db_id,
           mfhd_master.display_call_no, mfhd_master.mfhd_id
    FROM bib_text, item_barcode, bib_item, circ_transactions, mfhd_master, mfhd_item
    WHERE bib_text.bib_id = bib_item.bib_id
        AND mfhd_master.mfhd_id = mfhd_item.mfhd_id
        AND mfhd_item.item_id = circ_transactions.item_id
        AND bib_item.item_id = item_barcode.item_id
        AND circ_transactions.item_id = bib_item.item_id
        AND circ_transactions.db_id = '<0 or your value here>'
        AND (mfhd_master.location_id = '<your choice here>'
             OR mfhd_master.location_id = '<your choice here>')
        ORDER BY mfhd_master.display_call_no
        " ;
// Get a statement identifier from the database using OCIParse
$iStatement = @OCIParse($iDBConn, $query);
// Verify that the SQL statement is valid
$arrError = OCIError($iStatement);
if ($arrError['code']) {
    print $arrError['message'];
// Run the query on the database
@OCIExecute($iStatement, OCI_DEFAULT);
// Display the select statement
// Loop through the results
while (OCIFetchInto($iStatement, &$array1, OCI_ASSOC+OCI_RETURN_NULLS)) {
Call No:<font color=blue> <?= $array1['DISPLAY_CALL_NO'] ?></font><br>
Author:         <?= $array1['AUTHOR'] ?><br>
Title:          <?= $array1['TITLE'] ?><br>
Barcode:        <?= $array1['ITEM_BARCODE'] ?><br>
Charge Date:    <?= $array1['CHARGE_DATE'] ?><br>
Current Due Date: <?= $array1['CURRENT_DUE_DATE'] ?><br>
</Code sample>

Known issues

MUST select small collection values for location(s) due to length of report and processing time.


Especially useful for tracking circulation of normally closed stack items.

Leave a Reply