The following is the code that is controlling the edtit festure, thanks for the help
James
<?php
require_once("database_functions.php");
require_once("display_functions.php");
echo "<h1>Touch Canterbury Administration - Edit a Module</h1>";
$name = get_module_name($module_id);
echo "Details for the ".$name." Module";
$module_array = get_a_module($module_id);
edit_display_module($module_array);
?>
function get_a_module($module_id)
{
$conn = mysql_connect("localhost", "james", "password");
//display a error message if can't connect to the database
if(!$conn)
{
echo "Can't connect to the database, please try again later";
return false;
}
//select the database that is required
$db = "touch";
$select_db = mysql_select_db($db);
//create a query
$query = "select * from modules where module_id = $module_id";
$result = mysql_query($query);
if(!$result)
return false;
//produce an error if there was no data in the query returned
$num_modules = mysql_num_rows($result);
if($num_modules == 0)
return false;
//Close the connection to the mysql database
$close_conn = mysql_close();
//put data into an array
$result = db_result_to_array($result);
return $result;
}
function db_result_to_array($result)
{
$res_array = array();
for ($count = 0; $row = mysql_fetch_array($result); $count++)
$res_array[$count] = $row;
return $res_array;
}
function display_a_module($module_array)
{
if(!is_array($module_array))
{
echo "No modules currently available<br />";
return;
}
echo "<table width = 70% border = 1>";
foreach($module_array as $row)
{
echo "<tr>";
echo "<td width = 40%><b>Module ID</b></td>";
echo "<td>".$row["module_id"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Module Name</b></td>";
echo "<td>".$row["module_name"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Module Night</b></td>";
echo "<td>".$row["module_night"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Park Name</b></td>";
echo "<td>".$row["park_name"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's First Name</b></td>";
echo "<td>".$row["organiser_first_name"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Last Name</b></td>";
echo "<td>".$row["organiser_last_name"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Address</b></td>";
echo "<td>".$row["organiser_address"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Suburb</b></td>";
echo "<td>".$row["organiser_suburb"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's City</b></td>";
echo "<td>".$row["organiser_city"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Home Phone</b></td>";
echo "<td>".$row["organiser_home_phone"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Cell Phone</b></td>";
echo "<td>".$row["organiser_cell_phone"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's Fax</b></td>";
echo "<td>".$row["organiser_fax"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Organiser's E-mail</b></td>";
echo "<td>".$row["organiser_email"]."</td>";
echo "</tr>";
}
echo "</table>";
}