IBM

index.php

<?
   // 
   // This material contains IBM copyrighted sample programming source 
   // code DB2(R) UDB PHP Demo.  IBM grants you a nonexclusive copyright 
   // license to use the Sample Code as an example from which you can 
   // generate similar function tailored to your own specific needs.  
   // Your license to this Sample Code provides you no right or licenses 
   // to any IBM patents.
   // 
   // The Sample Code is provided by IBM for illustrative purposes 
   // only.  The Sample Code has not been thoroughly tested under 
   // all conditions.  IBM, therefore, does not  guarantee or imply 
   // its reliability, serviceability, or function.  IBM provides 
   // no program services for the Sample Code.
   //  
   // All Sample Code contained herein is provided to you "AS IS" without 
   // any warranties of any kind. THE IMPLIED WARRANTIES OF 
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
   // AND NON-INFRINGMENT ARE EXPRESSLY DISCLAIMED.  SOME 
   // JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED 
   // WARRANTIES, SO THE ABOVE EXCLUSIONS MAY NOT APPLY 
   // TO YOU.  IN NO EVENT WILL IBM BE LIABLE TO ANY PARTY 
   // FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL 
   // DAMAGES FOR ANY USE OF THE SAMPLE CODE INCLUDING, 
   // WITHOUT LIMITATION, ANY LOST PROFITS, BUSINESS 
   // INTERRUPTION, LOSS OF PROGRAMS OR OTHER DATA ON 
   // YOUR INFORMATION HANDLING SYSTEM OR OTHERWISE, 
   // EVEN IF WE ARE EXPRESSLY ADVISED OF THE POSSIBILITY 
   // OF SUCH DAMAGES.
   // 
   // (C) Copyright IBM CORP. 2001
   // All rights reserved.
   // US Government Users Restricted Rights -
   // Use, duplication or disclosure restricted
   // by GSA ADP Schedule Contract with IBM Corp.
   // Licensed Material - Property of IBM	

   //////////////////////////////////////////////////////////////
   // iSeries Linux DB2/PHP/ODBC Demo
   // Written by Dave Boutcher (boutcher@us.ibm.com)
   //////////////////////////////////////////////////////////////
   // This PHP script does the initial page
   //////////////////////////////////////////////////////////////
   include("checkauth.inc");

   // Count the number of employee records
   $cur=db2_exec($db,"select count(empno) from employee");
   checksql($cur);
   $rc = db2_fetch_row($cur);
   $nemp = db2_result($cur,0);

   // Count the number of department records   
   $cur=db2_exec($db,"select count(deptno) from department");
   checksql($cur);
   $rc = db2_fetch_row($cur);
   $ndept = db2_result($cur,0);
   
   // Count the number of project records   
   $cur=db2_exec($db,"select count(projno) from project");
   checksql($cur);
   $rc = db2_fetch_row($cur);
   $nproj = db2_result($cur,0);
   
   // Count the number of activity records   
   $cur=db2_exec($db,"select count(actno) from act");
   checksql($cur);
   $rc = db2_fetch_row($cur);
   $nact = db2_result($cur,0);

   // Include the standard banner and buttons on the page
   include("html_mainhdr.inc");

   // Output the information on the database
   echo "<p>There are currently $nemp <a href=\"emplist.php\">employees</a>, ";
   echo "$ndept <a href=\"deptlist.php\">departments</a>, ";
   echo "$nproj <a href=\"projlist.php\">projects</a>, and ";
   echo "$nact <a href=\"actlist.php\">activities</a> recorded in this database.";
?>
<p>Explore the database.  On each page, you can look at the PHP source that 
generated the page using the link at the bottom.</p>
<p>PHP is mixed in with HTML on a web page.  The PHP portions are stored between
&lt;? and ?&gt tags.</p>
<p>There are a couple of interesting database features here.  Some employees have 
pictures and resumes stored in the database.  From the employee list you can see
which employees have these.  When these employees are retrieved, the pictures are
retrieved as <q>BLOBs</q> (Binary Large OBjedts) from the database.  The resumes are 
retrieved as <q>CLOBs</q> (Character Large OBjects)</p>
<?
   // Include the standard page footer
   include("html_mainftr.inc"); 
?>








Source for this page: showsource.php