Snaip3Rs Posted January 5, 2010 Report Share Posted January 5, 2010 Man ir ipb forums un tur visu rada normāli, bet te ir kautkāds gļuks ko nesaprotu! Skripts <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <? $db=(object)array( 'host'=>'localhost', // Datubazes hosts 'user'=>'admin', // Datubazes lietotajs 'pass'=>'9969470', // Datubazes lietotaja parole 'name'=>'db', // Datubazes nosaukums 'prefix'=>'ibf_members', // Bla, bla ); $reg = mysql_query("SELECT * FROM ibf_members"); $reg = mysql_num_rows($reg); $delay = "1500"; $delay = time() - $delay; $useri = mysql_query("SELECT * FROM ibf_sessions WHERE member_id != '0' and running_time >= ".$delay.""); $regon = mysql_num_rows($useri); $viesi = mysql_query("SELECT * FROM ibf_sessions WHERE member_id = '0' and running_time >= ".$delay.""); $viesi = mysql_num_rows($viesi); $kopa = $regon + $viesi; echo ' Lietotāji: '.$regon.'<br /> Viesi: '.$viesi.'<br /> Kopā: '.$kopa.'<br /> Reģistrējušies: '.$reg.'<br /> <hr style="margin:2px 0;"/> '; while ($users = mysql_fetch_array($useri)){ $group = $users['member_group']; $q = mysql_query("SELECT * FROM ibf_groups WHERE g_id = '$group'"); while($group = mysql_fetch_array($q)){ if(empty($group['prefix'])){ $prefix = "<span style=\"color:black\">"; $suffix = "</span>"; } else{ $prefix = $group['prefix']; $suffix = $group['suffix']; } echo "<a href='f/index.php?showuser=".$users['member_id']."' title='".$users['member_name']."'>".$prefix."".$users['member_name']."".$suffix."</a><br />"; } } ?> Nezinu kapē dubulto lietotājus! :( Un lūdzu pasakiet vel vienu lieto kā var dabūt jaunākais lietotājs kas ir registrējies! Paldies ju ieprieks par palīdzību! Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted January 5, 2010 Report Share Posted January 5, 2010 Man izskatās, ka lietotājs qwerty ir atvēris divas sesijas, tādēļ arī rāda divreiz. Vispār jau lietotāju atlases vaicājumu būtu jāraksta kopā ar grupas parametru atlasi: SELECT DISTINCT u.member_id AS member_id, u.member_name AS member_name, g.suffix AS suffix, g.prefix AS prefix FROM ibf_sessions AS u LEFT JOIN ibf_groups AS g ON u.member_group = g.g_id WHERE u.member_id != 0 AND u.running_time >= $delay 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.