Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Ponumerowanie wynikow z bazy danych
saren_as
post
Post #1





Grupa: Zarejestrowani
Postów: 53
Pomógł: 0
Dołączył: 21.07.2008

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


Witam!
Mam taki kod, ktory pobiera mi dane z bazy. Chcial bym teraz, aby w pierwszym rzedzie tabeli byly numer od 1 do ... ilosc wyswietlonych rekordow. Prosciej mowiac chce wiedziec ile jest wyswietlonach rekordow. Nie wiem, jak mam zbudowac taka petle.
#; Adres_IP_if_existing; Max_filer_id; Step_1; user_disk_usage;
1; jakies IP; jakies id; jakis krok; jakies usage;
2; jakies IP; jakies id; jakis krok; jakies usage;

Pozdrawiam!
saren_as

  1. <?php
  2. /* ?  */
  3.  $moved_vds_usage = 0;
  4.  $Id = 0;
  5.  while ($moved_vds_usage <= $avg['avg_usage'] and $row = mysql_fetch_array($results_1)) {
  6.  $Id++;
  7.  $vserver_ip = $row['vserver_ip'];
  8.  $filer_id = $row['filer_id'];
  9.  $disk_usage = $row['disk_usage'];
  10.  $moved_vds_usage = $moved_vds_usage + $disk_usage;
  11.  
  12.  $select_1 .=<<<EOD
  13.   <tr>
  14.     <td><center>$Id</center></td>
  15.     <td><center>$vserver_ip</center></td>
  16.     <td><center>$filer_id</center></td>
  17.     <td><center>1</center></td>
  18.     <td><center>$disk_usage ($moved_vds_usage)</center></td>
  19.   </tr>
  20. EOD;
  21. }
  22.  
  23. /************  table_start  ************/
  24. $table_start=<<<EOD
  25. <h2><center>VDS</center></h2>
  26. <table width="70%" border="1" cellpadding="2" cellspacing="2" align="center">
  27.   <tr>
  28.     <th>#</th>
  29.     <th>Adres_IP_if_existing</th>
  30.     <th>Max_filer_id</th>
  31.     <th>Step_1</th>
  32.     <th>user_disk_usage (Summe)</th>
  33.   </tr>
  34. EOD;
  35. ?>


Ten post edytował saren_as 16.09.2008, 11:19:59
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
saren_as
post
Post #2





Grupa: Zarejestrowani
Postów: 53
Pomógł: 0
Dołączył: 21.07.2008

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


Dalem juz wczesniej edita, ale pisze bo moze nie przeczytales. Dzieki za pomoc, juz sobie poradzilem tak jak mowiles. Dla mnie takie drobnostki niestety jeszcze czesto sprawiaja duuuze problemy...ale zawsze mam Was wiec dzieki (IMG:http://forum.php.pl/style_emoticons/default/smile.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: 17.10.2025 - 03:39