First time poster long time googler...
I'm wishing to extract some data from a database and combining related fields. For example:
Database Structure:
Field1:AhDataNum - Field2:AhDataLemma
83 - Adam
10 - Heinrich
12 - Heinrich
43 - Joe
Desired Output:
Adam - 83
Heinrich - 10, 12
Joe - 43
What it does:
I'm just trying to combine all Heinriches into one and combining the DataNums after it. Below is my current code which just lists the data structure from above. Need help getting it to look like my desired output so I can complete working on the name register portion of my german dictionary. Thank you for at least reading my plee for assistance. Look forward to any possible solutions! 🙂 Happy Holidays as well.
$i=0;
// Run Loop for Data Retreival
while($results = mysql_fetch_array($result)) {
// Generates different background colors for every other table row
if (($i%2)==0) { $bgColor = "#FFFFFF"; }
else { $bgColor = "#C0C0C0"; }
// Creates rows
echo "<tr bgcolor=\"$bgColor\">\n".
"<td align=\"center\">", $results['AhDataLemma'], "</td>\n".
"<td>", $results['AhDataNum'], "</td>\n".
"</tr>\n";
$i++;
} // end while loop
Sincerely,
Endurox