Source for file muffinlist.php

Documentation is available at muffinlist.php

  1. <?
  2. /**
  3.  * muffinlist.php shows all muffins with links to view a details page, muffinview.php
  4.  * 
  5.  * @package ITC280
  6.  * @author Bill Newman <williamnewman@gmail.com>
  7.  * @version 1.0 2008/05/03
  8.  * @link http://www.newmanix.com/itc280/
  9.  * @license http://opensource.org/licenses/osl-3.0.php Open Software License ("OSL") v. 3.0
  10.  * @see muffinview.php
  11.  * @todo none
  12.  */
  13.  
  14. /**
  15.  * If TRUE, will show errors on page, instead of making errors private.
  16.  * This variable can be over-ridden by $HideAllErrors variable in configINC.php
  17.  * @global boolean $HidePageErrors 
  18.  */
  19. $HidePageErrors FALSE
  20.  
  21. /**
  22.  * SQL statement - db name specified in SQL call, NOT in advance!
  23.  * @var string 
  24.  */
  25. $selSQL "select MuffinName, MuffinID, Price from bnewman.tblMuffins";
  26.  
  27. //END CONFIG AREA ---------------------------------------------------------- 
  28.  
  29. /**
  30.  * Provides 'myerror()' for error handling, and conn() for db connection
  31.  */
  32. include_once("include/utilINC.php");
  33.  
  34. //create default 'admin' level connection to MySQL
  35. $myConn conn();
  36.  
  37. //$result stores data object in memory
  38. $result @mysql_query($selSQL,$myConnor die(myerror(__FILE__,__LINE__,mysql_error()));
  39. ?>
  40. <html>
  41. <body>
  42. <h2 align=center>Pick A Muffin! (muffinlist.php)</h2>
  43. <div align="center">Select a muffin, to see how good they look!</div>
  44. <?
  45. //returns the number of records
  46. $numRows @mysql_num_rows($result);
  47.  
  48. if ($numRows 0)//at least one record!
  49. {//show results
  50.    while ($row mysql_fetch_array($result))
  51.    {//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
  52.          print '<div align="center">';
  53.          print '<a href="muffinview.php?id=' dbOut($row['MuffinID']'">' dbOut($row['MuffinName']'</a>';
  54.          print ' <i>only</i> <font color="red">$' money_format("%(#10n",dbOut($row['Price'])) '</font>';
  55.          print '</div>';
  56.     }
  57. }else{//no records
  58.     print "<div align=center>What! No muffins?  There must be a mistake!!</div>";
  59. }
  60. @mysql_free_result($result)//free resources
  61. @mysql_close()//close connection to db
  62. ?>
  63. </body>
  64. </html>

Documentation generated on Sat, 03 May 2008 19:47:45 -0700 by phpDocumentor 1.4.1