Jump to content
php.lv forumi

user count


ziedinjsh

Recommended Posts

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! :)

Link to comment
Share on other sites

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 by ziedinjsh
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...