Hello All,
I am trying hard to do the following and would GREATLY appreciate some help:
I have a database table with a field for name and a field for resources that person offers, among other things. One person may have resources to offer in several different departments or for several different projects. Right now, when I display the data in a table sorted by department, or project, or whatever, I get the name along with the data even if it is repeated. (I am using Dreamweaver MX 2004 and using Repeat Region to show the table with the data in it.) So for instance I get rows like this:
John Doe Chemistry
John Doe Biology
John Doe Pharmacology
Flo Schmoe Chemistry
What I'd like to do is exclude duplicates after the first instance of a given name, so my displayed data looks like this instead:
John Doe Chemistry
Biology
Pharmacology
Flo Schmoe Chemistry
Can't seem to figure out how to get this going. A little snippet of code I could modify and run with would be extremely helpful; can't seem to find a solution on the Web.
Thanks very much,
Bob
P.S. Code sample below:
The recordset:
$colvar3_resources_all = "all";
if (isset($GET['restype'])) {
$colvar3_resources_all = (get_magic_quotes_gpc()) ? $GET['resource_type'] : addslashes($GET['resource_type']);
}
$colvar2_resources_all = "all";
if (isset($GET['project'])) {
$colvar2_resources_all = (get_magic_quotes_gpc()) ? $GET['project'] : addslashes($GET['project']);
}
$colvar_resources_all = "all";
if (isset($GET['department'])) {
$colvar_resources_all = (get_magic_quotes_gpc()) ? $GET['department'] : addslashes($GET['department']);
}
mysql_select_db($database*dbset, $dbset);
$query_resources_all = sprintf("SELECT FROM resource WHERE '%s' = 'all' AND '%s' = 'all' AND '%s' = 'all' ORDER BY name ASC, resource.recordid ASC", $colvar_resources_all,$colvar2_resources_all,$colvar3_resources_all);
$resources_all = mysql_query($query_resources_all, $****dbset) or die(mysql_error());
$row_resources_all = mysql_fetch_assoc($resources_all);
$totalRows_resources_all = mysql_num_rows($resources_all);
The table itself:
<?php do { ?>
<tr class="****data">
<td><?php echo $row_resources_all['name']; ?></td>
<td><?php echo $row_resources_all['project']; ?></td>
<td><?php echo $row_resources_all['department']; ?></td>
<td><?php echo $row_resources_all['resource']; ?></td>
<td><?php echo $row_resources_all['resource_type']; ?></td>
<td><?php echo $row_resources_all['function']; ?></td>
<td><?php echo $row_resources_all['online_info']; ?></td>
</tr>
<?php } while ($row_resources_all = mysql_fetch_assoc($resources_all)); ?>
</table>