Hy
I have this code:
------------------------------------------------------------------------
$result = mysql_query("se lect * from smjestaj left join grad on
grad.grad=smjes taj.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=\"headlin e\"><td> Grad </td></tr>";
while ($qry = mysql_fetch_arr ay($result)) {
print "<tr><td><a href=\"" .
"lista_sa_linko vima_po_gradovi ma.php?grad=$qr y[grad_pbroj]\"[color=blue]
>$qry[Naziv]</a></td>";[/color]
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).
I have this code:
------------------------------------------------------------------------
$result = mysql_query("se lect * from smjestaj left join grad on
grad.grad=smjes taj.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=\"headlin e\"><td> Grad </td></tr>";
while ($qry = mysql_fetch_arr ay($result)) {
print "<tr><td><a href=\"" .
"lista_sa_linko vima_po_gradovi ma.php?grad=$qr y[grad_pbroj]\"[color=blue]
>$qry[Naziv]</a></td>";[/color]
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).
Comment