As dori sa intreb cum ar fi mai usor si mai rapid. Am o tabela in care am diferite user_id. As dori sa stiu cum as putea sa iau acel user_id si sa il apelez intr-o functie cu restul id-urilor din tabela.
Exemplu :
User id 2 3 4 5 6 7
As dori pentru fiecare user_id sa apelez o functie cu restul celorlalte user_id-uri ceva gen cand scot pe 2 , sa se apeleze function(2,3), function(2,4), function(2,5), etc.
Eu m-am gandit asa :
Cod: Selectaţi tot
1. fetch = select *from tabel;
while($x = mysql_fetch_assoc($fetch)){
fetch2 = select *from tabel where userid != $x['user_id'];//sa le luam pe celalte;
while($x2 = mysql_fetch_assoc($fetch2)){
function($x['user_id'],$x2['user_id']);
}
}
Exista o solutie mai ok decat aceasta ?mai optima?(fiindca ma gandesc ca la vreo 100 inserturi , sa nu faca crash ), 100*99 ori(niciodata cu el insusi).Sper sa nu fi gresit calculul.
[/code]