Jump to content
php.lv forumi

SQL JOIN vai Deadly while in while


sandis_m

Recommended Posts

Nevaru saprast, kā lai dabon uz lietotāja profila bildes saņemtās dāvanas.

 

SQL:

<?php

$friends->query = "
SELECT `lietotaji`.*, `davanas`.* , `davanu_faili`.*
FROM `lietotaji`
LEFT JOIN `davanas` ON `lietotaji`.uid = `gifts`.sanemejs
LEFT JOIN `davanu_faili` ON `davanas`.tips= `davanu_faili`.id
GROUP BY `lietotaji`.uid
";

?>

 

Un ir šādi:

1c83hvp657hev6ewmtx7.png

 

 

Bet konkrēti vajadzētu, lai būtu visi saņemtie kēksiņi.

 

Vai tiešām vajadzēs izmantot:

 

while($lietotaji){

//utt utt

while($davanas){
// utt utt
}

}

Link to comment
Share on other sites

bez group by

 

Noņēmu group by, bet tagad lietotāji dublējas

jskf94u4lszl7zcgbubg.png

 

 

 

Nū, man jau ir randomā

<?php
while($tiripiri){
?>
$rand_x = mt_rand(1,90);
$rand_y = mt_rand(1,90);

<div class="gifta">
<div style="top:<?php echo $rand_y;?>px;left:<?php echo $rand_x;?>px;background: url('<?php echo $data["file_sm"];?>') no-repeat scroll center center;width:58px;height:57px;">
</div>
</div>


<?php echo $name." "$lastname;?> <!-- utt -->
<?php
}
?>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...