|
Posted by Dejan on 04/14/06 12:47
Hy
I have this code:
------------------------------------------------------------------------
$result = mysql_query("select * from smjestaj left join grad on
grad.grad=smjestaj.grad_pbroj order by grad_pbroj ASC", $db) or die ("Could
not read data because ".mysql_error());
// print the data in a table
if (mysql_num_rows($result)) {
print "<table cellspacing=0 border=1 width=\"25%\" class=\"redovi\">\n";
print "<tr class=\"headline\"><td> Grad </td></tr>";
while ($qry = mysql_fetch_array($result)) {
print "<tr><td><a href=\"" .
"lista_sa_linkovima_po_gradovima.php?grad=$qry[grad_pbroj]\"
>$qry[Naziv]</a></td>";
print "</tr>\n";
}
print "</table>\n";
}
mysql_close($db);
------------------------------------------------------------------------
Table smjestaj has coloumns:
id | Name | grad_pbroj | ...
Table grad has coloumns:
grad_pbroj | Naziv|
Now i wanna display all the grad_pbroj coloumns from 'smjestaj', buth not
displaying duplicates, just to count them, and put the count behind the
'grad_pbroj' coloumn.
Result:
Naziv_first (3)
Naziv_second (1)
Naziv_third (8)
I nead full solution, because i have tried everythig and either sql of php
displaying is fucking me.
I have tried all of that group by, count sql syntax, and i allways get
error.
Anyone cann help me plz.
Dejan
ps. sorry to all the people i have asked this before, buth not giving full
description (Arjen, Jerry Stuckle).
Navigation:
[Reply to this message]
|