Reserves Report
- 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, advanced, expert. Please also add your choice as a tag at the bottom of the page.
State
Stable
Working example
http://lib.hamilton.edu:3000/res.php
Installation instructions
PHP 5.2.0 using oci8 into Oracle 9.2.0 over Apache 2.0.59
<Code sample> <? // Request sort order from user $entry = $_GET['sortinfo']; if (is_null($entry)) { ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET"> RESERVES REPORT<br> Select Sort Preference: <SELECT name="sortinfo" onChange="this.form.submit();"> <OPTION selected> ==CHOOSE==<OPTION> list_title<OPTION> effect_date<OPTION> expire_date<OPTION> </SELECT> </form> <? } else { ?> <? // This include file contains the logon username, password, and database name require('../db-include.inc'); // Connect to the database by passing logon information $iDBConn = OCIpLogon(DB_USER, DB_PASS, DB_NAME); // Define your query in SQL $query = " SELECT list_title, effect_date, expire_date FROM reserve_list WHERE expire_date between to_date('<your_date>', 'dd/mm/yyyy') and to_dat e('<your_2d_date>', 'dd/mm/yyyy') ORDER BY $entry" ; // 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']; OCIRollback($iDBConn); exit; } // Run the query on the database @OCIExecute($iStatement, OCI_DEFAULT); // Debug -- display the select statement // echo "Select statement = $query<br><br>"; ?> <table> <? // Loop throught the results $line=1; while (OCIFetchInto($iStatement, &$array1, OCI_ASSOC+OCI_RETURN_NULLS)) { ?> <tr><td><b><?= $array1['LIST_TITLE'] ?></b></td><td>.....</td> <td><?= $array1['EFFECT_DATE'] ?></td><td>.....</td> <td><?= $array1['EXPIRE_DATE'] ?></td><td></td></tr> <? $line++; } ?> </table> <hr> <?= $line-1 ?> course reserves listed<br><hr> <? printf(date('F j Y')); // end of else statement } ?> </Code sample>
TO DO list
Could add fields; make live links to OPAC; selectable date ranges…
Known issues
This is a quick overview of reserve lists within the date range only.