Jon Damon MySQL Exercise

[article] [edit page] [discussion] [history]

From Humanitarian-FOSS Project Development Site


Source Code

/* $Id:,v 1.0 2007/01/31  */
 * Class List

 * @package    Hello_World_Module
 * @copyright  Copyright {@link Lanka Software Foundation} 2006
 * @license GNU Lesser General Public License (LGPL) 
 * @author     Jonathan Damon <>

 * Retrieve information from the tables.
 * The query joins the 3 tables and selects only the fields I need.
 * After execute the information is stored in $result.
 * Then I break out of php and set up the table header.
global $global;
$q = "select, email,, state, role, from members, teams, schools where = teams.number and =";
 <div id="home">
       <h2><?=_("Class List")?></h2>
       <table width="100%">
         <td><?=_("Team Name")?></td>

 * Now I loop through result and pull out my fields.
 * Each time through, I break out of php, put the data in the table,
 * and enter php to advance $result at the end of the loop.
 * The end tags close the table.
while(!$result==NULL && !$result->EOF){     
          <td><?php echo $result->fields[0]?></td>
          <td><?php echo $result->fields[1]?></td>
          <td><?php echo $result->fields[2]?></td>
          <td><?php echo $result->fields[3]?></td>
          <td><?php echo $result->fields[4]?></td>
          <td><?php echo $result->fields[5]?></td>


     <br />

Personal tools