Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [POMOC] Modyfikacja funkcji PHP
Rak115
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 28.11.2009

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


Witam. Proszę o pomoc z poniższą funkcją. Wyświetla ona jeden losowy rekord z bazy. Chciałbym, aby wyświetlała dwa losowe rekordy z bazy. Jak to zrobić?

Poniżej kod funkcji:
Kod
   $group = select('groups', 'id', 'premium_box = "1"', '', '');
  
   for ($j=0; $j<count($group); $j++) {
      $groups .= $group[$j]['id'];
      if ($j != count($group)-1) $groups .= ', ';
   }

   if (count($group) > 0) {
      $select = select('sites', 'id, title, description, url, date, `group`', '`group` in ('.$groups.') && active = "1"', '', '');
      if (count($select) > 0) {
         $select[0] = $select[rand(0, count($select)-1)];
         if ($_GET['action'] == 'premium_box') {
            $select[0]['count'] = count($select);
            unset($_SESSION['group']);
            $_SESSION['group'] = $group[0]['id'];

            $check_group = select('groups', 'days', 'id = "'.$select[0]['group'].'"', '', '');
            if ($check_group[0]['days'] == 0) $select[0]['time'] = time();
            else $select[0]['time'] = $select[0]['date']+($check_group[0]['days']*24*60*60);
         }
         if ($GLOBALS['cfg']['box_premium_link'] == 0) $select[0]['link'] = url('site', $select[0]['title'], $select[0]['id']);
         else $select[0]['link'] = $select[0]['url'];
      }
   }
  
   return $select;


Kto pomoże, temu podziękuje (IMG:style_emoticons/default/winksmiley.jpg) (IMG:style_emoticons/default/aaevil.gif)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 23.08.2025 - 22:12