I have a query that when it runs, simply lists a coursename and then all the details about that course. Trouble is the look of this query sucks.
You know in MS Access when you run a form design wizard and you can present a query by justifying it, putting it ib columns or a table? well Im am trying to justify it so it comes out looking like a form- how can I do this?
Here is my code so far:
<?php
if (isset($_GET['course'])) {
$user = "root";
$host = "localhost";
$password = "";
$connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to server.");
$database = "memlms";
$db = mysql_select_db($database) or die ("Couldn't select database.");
$course = mysql_real_escape_string($_GET['course']);
$res = "SELECT * FROM trainingtopics WHERE course_name = '$course'";
$result = mysql_query($res) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo '
<tr>
<td width="100%"><strong><p align="center" class="style4 style11"><td>' . $row['course_name'] .'</td></strong></p>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Aimed at</strong></p>
<br>
<td>' . $row['aimedat'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Level 1?</strong></p>
<br>
<td>' . $row['level1'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Level 2?</strong></p>
<br>
<td>' . $row['level2'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Level 3?</strong></p>
<br>
<td>' . $row['level3'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Available through e learning?</strong></p>
<br>
<td>' . $row['elearning'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Availble through face to face classroom based training?</strong></p>
<br>
<td>' . $row['facetoface'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Available through blended learning? (face to face and e learning)</strong></p>
<br>
<td>' . $row['blendedlearning'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">E learning study time</strong></p>
<br>
<td>' . $row['elearntime'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Face to face learning study time</strong></p>
<br>
<td>' . $row['facetime'] . '</td>
<br>
<td width="79%"><strong><p align="left" class="style4 style11">Blended learning study time</strong></p>
<br>
<td>' . $row['blendedtime'] . '</td>
<br>
</tr>
';
}
} else {
//course name not found
//note: the query may have failed to so maybe check for that.
}
} else {
//no course specified
}
?>