I have a typical query which echos results. In some cases though there is a null value in the record. For example
<?php
if (isset($_GET['quality_name'])) {
include ("connect.php");
$course = mysql_real_escape_string($_GET['quality_name']);
$res = "SELECT * FROM qualityadmin WHERE quality_name = '$quality_name'";
$result = mysql_query($res) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
// begin output here:
$dtld = array('http://', 'www.', '.com', '.edu', '.fr', '.org', '.eu', '.us', '.biz', '.net', '.cz', '.it', '.cc', '.ca', '.pdf','.html'); // Add other TLD items as needed
echo '<style type="text/css">
#myTable td {
font-family:arial, helvetica, sans-serif;
font-size: 14px;
}
.heading {
background:#eee;
color: #0000cc;
}
</style>
<table cellpadding="2" cellspacing="0" border="1" id="myTable" width="700px">
<tr>
<td colspan="3">' . $row['image'] .'</td>
</tr>
<tr>
<td class="heading" colspan="4">Quality name</td>
</tr>
<tr>
<td colspan="3">' . $row['quality_name'] . '</td>
</tr>
<tr>
<td class="heading" colspan="4">Authority Body</td>
</tr>
<tr>
<td colspan="3">' . $row['authority_body'] . '</td>
</tr>
<tr>
<td class="heading">Address 1</td>
<td class="heading">Address 2</td>
<td class="heading">Town</td>
</tr>
<tr>
<td>' . $row['address1'] . '</td>
<td>' . $row['address2'] . '</td>
<td>' . $row['town'] . '</td>
</tr>
<tr>
<td class="heading">Postcode</td>
<td class="heading">Telephone</td>
<td class="heading">Email</td>
</tr>
<tr>
<td>' . $row['postcode'] . '</td>
<td>' . $row['telephone'] . '</td>
<td>' . $row['email'] . '</td>
</tr>
<tr>
<td class="heading" colspan="3">Website</td>
</tr>
<tr>
<tr>
<td colspan="3"><a href="'. ((strpos($row['website'], 'http://')===false)?'http://':'') . $row['website'] .'" target = "_blank">'. str_replace($dtld, '', $row['website']). '</a></td>
</tr>
<tr>
<td class="heading" colspan="3">Local Agency</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['local_agency'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">Contact</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['contact'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">What is it</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['what_is_it'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">Who and what does it apply to?</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['who_what_apply'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">How does it work?</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['how_work'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">What are the resource implications?</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['resource_implications'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">How do you meet the standards and get assessed?</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['how_meet_standards'] ).'</td>
</tr>
<tr>
<td class="heading" colspan="3">How widespread is it?</td>
</tr>
<tr>
<td colspan="3">' . nl2br( $row['widespread'] ) .'</td>
</tr>
<tr>
<td class="heading" colspan="3">What are the pros and cons?</td>
</tr>
<tr>
<td colspan="3">' . $row['pros_cons'] .'</td>
</tr>
<tr>
<td class="heading" colspan="3">What are the benefits?</td>
</tr>
<tr>
<td colspan="3">' . $row['benefits'] .'</td>
</tr>
<td class="heading" colspan="3">Acknowledgements</td>
</tr>
<tr>
<td colspan="3">' . $row['acknowledgement'] .'</td>
</tr>
</table>';
}
} else {
//course name not found
//note: the query may have failed to so maybe check for that.
}
} else {
//no course specified
}
?>
this query returns quality_name, authority_body, address1, address2, what_is_it etc but some of the results will not have an entryn in the field 'what_is_it'. I still want to echo the record but where there is a null value I do not want the field title to show as above.
how can I adapt the the select * command to achieve this