Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Skrypt Enter
mrk9109
post
Post #1





Grupa: Zarejestrowani
Postów: 445
Pomógł: 3
Dołączył: 4.06.2010

Ostrzeżenie: (0%)
-----


Witam mam swoj skrypt members.php i wszystko działa dodaje mi użytkowników tak jak powino no ale chciałem teraz zrobić coś takiego gdy liczba użytkowników przekroczy np: liczbe 2 robi <br> próbowałem to zrobić w taki sposób ale nie działa (IMG:style_emoticons/default/sad.gif)
Kod
if($i%$user==2) echo '<br />';

members.php
http://wklej.org/id/393268/
Go to the top of the page
+Quote Post
Spawnm
post
Post #2





Grupa: Moderatorzy
Postów: 4 069
Pomógł: 497
Dołączył: 11.05.2007
Skąd: Warszawa




zobacz if($i%2==0){ reszta = 0 }else{ resta != 0}
Go to the top of the page
+Quote Post
mrk9109
post
Post #3





Grupa: Zarejestrowani
Postów: 445
Pomógł: 3
Dołączył: 4.06.2010

Ostrzeżenie: (0%)
-----


nie działa ale zrobiłem to teraz inaczej automatycznie dodaje mi jednego pod drugim a jak zrobić aby dopiero np: po 3 unserach robił <br /> ?

Ten post edytował mrk9109 25.09.2010, 16:16:56
Go to the top of the page
+Quote Post
krispak
post
Post #4





Grupa: Zarejestrowani
Postów: 250
Pomógł: 55
Dołączył: 27.08.2008

Ostrzeżenie: (0%)
-----


To co dal @Spawnm dziala tyle ze zmienna $i musisz zwiekszac poprzez $i++
  1. $i = 1;
  2. while(twoje dane)
  3. {
  4. if($i++ == 3)
  5. {
  6. $br = "<br>";
  7. $i = 1;
  8. } else {
  9. $br = "";
  10. }
  11. $name = "uzytkownik".$br;
  12. }
Go to the top of the page
+Quote Post
mrk9109
post
Post #5





Grupa: Zarejestrowani
Postów: 445
Pomógł: 3
Dołączył: 4.06.2010

Ostrzeżenie: (0%)
-----


to jak to ma byc ;/ ja troche slaby w php on ciagle powtarza proces i dodaje jednego pod drugim to czesc kodu o ktorym mowimy :
  1. $i=1;
  2. while($dm=mysql_fetch_array($member)) {
  3.  
  4. if($i%2) {
  5. $bg1=BG_1;
  6. $bg2=BG_2;
  7. }
  8. else {
  9. $bg1=BG_3;
  10. $bg2=BG_4;
  11. }
  12.  
  13. $country = '[flag]'.$dm['country'].'[/flag]';
  14. $country = flags($country);
  15. $nickname = strip_tags(stripslashes($dm['nickname']));
  16. $profilid = $dm['userID'];
  17.  
  18. $icq = $dm['icq'];
  19. if(getemailhide($dm['userID'])) $email = '';
  20. else $email = '<a href="mailto:'.mail_protect($dm['email']).'"><img src="images/icons/email.gif" border="0" width="15" height="11" alt="email" /></a>';
  21. $emaill = $dm['email'];
  22.  
  23. $pm = '';
  24. $buddy = '';
  25. if ($loggedin && $dm['userID'] != $userID)
  26. {
  27. $pm='<a href="index.php?site=messenger&action=touser&touser='.$dm['userID'].'"><img src="images/icons/pm.gif" border="0" width="12" height="13" alt="messenger" /></a>';
  28.  
  29. if (isignored($userID, $dm['userID'])) $buddy='<a href="buddys.php?action=readd&id='.$dm['userID'].'&userID='.$userID.'"><img src="images/icons/buddy_readd.gif" width="16" height="16" border="0" alt="back to buddy-list" /></a>';
  30. elseif(isbuddy($userID, $dm['userID'])) $buddy='<a href="buddys.php?action=ignore&id='.$dm['userID'].'&userID='.$userID.'"><img src="images/icons/buddy_ignore.gif" width="16" height="16" border="0" alt="ignore user" /></a>';
  31. elseif($userID==$dm['userID']) $buddy="";
  32. else $buddy='<a href="buddys.php?action=add&id='.$dm['userID'].'&userID='.$userID.'"><img src="images/icons/buddy_add.gif" width="16" height="16" border="0" alt="add to buddylist" /></a>';
  33. }
  34.  
  35. if (isonline($dm['userID'])=="offline") $statuspic='<img src="images/icons/offline.gif" width="7" height="7" alt="offline" />';
  36. else $statuspic='<img src="images/icons/online.gif" width="7" height="7" alt="online" />';
  37.  
  38. $position=$dm['position'];
  39. $firstname=strip_tags($dm['firstname']);
  40. $lastname=strip_tags($dm['lastname']);
  41. $town=strip_tags($dm['town']);
  42. if($dm['activity']) $activity='<font color="'.$wincolor.'">'.$_language->module['active'].'</font>';
  43. else $activity='<font color="'.$loosecolor.'">'.$_language->module['inactive'].'</font>';
  44.  
  45. eval ("\$members_content = \"".gettemplate("members_content")."\";");
  46. echo $members_content;
  47. $i++;
  48.  
  49.  
  50. }

EDIT :

problem rozwiazany

Ten post edytował mrk9109 26.09.2010, 12:19:08
Powód edycji: [Spawnm]: poprawiłem BBcode
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 22:03