Jump to content
php.lv forumi

ROW


Ugga

Recommended Posts

man ir tabula files tur ir lauki artist,song,text. ir vajadziba uztaisiit skriptu, kas panjem visas rindas un prieksh katra artista saskaita cik vinjam ir songu. PS artist nav zinaams. skripts atrod visus iespeejamos artist un tad katram artist saskaita dziesmas. beigaas ir doma izveidot statistiku ar visu artistu sarakstu un dziesmu skaitu. kaa to vareetu panaakt? :unsure:

Link to comment
Share on other sites

nee tjipa taaa artistus vienaa un dzismas otraa

----------------------------

tabula1

 

pk_artist

artist

----------------------------

tabula2

 

pk_song

song

text

fk_artist

---------------------------

$sql= mysql_query("select * from tabula1");

while ($row = mysql_fetch_array($sql))
{
$pk_artist = $row['pk_artist'];
$artist = $row['artist'];
$sql_skaits = mysql_query("SELECT COUNT(fk_artist) as skaits  FROM  tabula2 WHERE fk_artist = '$pk_artist'");
$row2 = mysql_fetch_array($sql_skaits);
$skaits = $row2['skaits'];
echo $artist ."ir tāds".$skaits."dziesmu skaits<br>";
}

 

 

nu kautkā tā :rolleyes:

Edited by trinklins
Link to comment
Share on other sites

×
×
  • Create New...