Hi,
This has been troubling me for the last hour and I cant think of a way around it.
My SQL table looks like this:
Name, Cost
Matt, $5.00
Carl, $4.50
Tom, $6.00
Tom, $7.50
I need to make a query so that it puts anything with the same Name on 1 line like this:
<td>Matt, $5.00</td>
<td>Carl, $4.50</td>
<td>Tom, $6.00, $7.50</td>
My current SQL is below and it just displays 4 individual rows as expected:
$sql="name, price from table1";
echo "<tr><td>Name</td><td>>Price</td></tr>";
if ($result=mysql_query($sql)) {
while ($row=mysql_fetch_assoc($result)) {
echo "<td>".$row['name']."</td>";
echo "<td>".$row['price']."</td></tr>";}}