ziedinjsh Posted April 6, 2010 Report Share Posted April 6, 2010 useri izvadās šādi: $query = "SELECT * FROM users"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo "<div class='producer'>"; echo "<div class='avatar'>"; if ($row['avatar'] !=""){ echo "<a href='profile.php?id=".$row['user_id']."'><img src='avatars/".$row['avatar']."' height='100'></a>"; }else{ echo "<img src='avatars/no_avatar.png' width='100' height='100'>"; } echo "</div>"; echo "".$row['username'].""; echo "</div>"; } kā lai es vēl izvadu ko līdzigu šim $user_count = mysql_query_rows($query); ? ja pieliek šādu tad rāda Fatal error: Call to undefined function musql_query_rows() in D:\WEB\www\1\producers.php on line 11 Kā es varu apvienot? Paldies jau ieprieks! :) Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 6, 2010 Report Share Posted April 6, 2010 nevis mysql_query_rows bet mysql_num_rows Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 6, 2010 Author Report Share Posted April 6, 2010 (edited) tagad izmeta Warning: mysql_num_rows() expects parameter 1 to be resource, string given in D:\WEB\www\1\producers.php on line 11 a, sapratu kļūdu.. vajadzēja šādi $user_count = mysql_num_rows($result); nevis $user_count = mysql_num_rows($query); Edited April 6, 2010 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 6, 2010 Report Share Posted April 6, 2010 tad kad tev saradīsies dafiga useru tad tu noteikti ieviesīši sadalīšanu pa lapām, tad nederēs skaita iegūšanai šis variants, savādāk šis izvadīs tikai to skaitu cik ir lapā useru. iekš kverija SELECT users.*, COUNT(users.id) skaits FROM users Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted April 6, 2010 Report Share Posted April 6, 2010 Ziedinja jautaajumi mani paarsteidz ar katru reizi vairaak! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.