Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]Pobieranie kolejnych rekordów z bazy
kuli95
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 8.07.2012

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


Witam. Mam problem, w bazie dodane mam 3 rekordy a ponizszy kod nie działa tak jak powinien
  1. <?php
  2. include('/config.php');
  3.  
  4. $query = "SELECT * FROM `panel`;";
  5. $sql = mysql_query($query);
  6. if ($sql)
  7. {
  8. $pages[] = mysql_fetch_array($sql);
  9. var_dump($pages);
  10. }
  11. ?>


a funkcja var_dump($pages) zwraca tylko jeden rekord:

  1. array (size=1)
  2. 0 =>
  3. array (size=6)
  4. 0 => string '1' (length=1)
  5. 'id' => string '1' (length=1)
  6. 1 => string 'asdf' (length=4)
  7. 'name' => string 'asdf' (length=4)
  8. 2 => string '3igrub' (length=6)
  9. 'parameter' => string '3igru
Go to the top of the page
+Quote Post
_Borys_
post
Post #2





Grupa: Zarejestrowani
Postów: 587
Pomógł: 190
Dołączył: 5.02.2011
Skąd: 64-800

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


  1. while($row = mysql_fetch_array($sql)){
  2. echo '<pre>';
  3. var_dump($row);
  4. echo '</pre>';
  5. }


Ten post edytował _Borys_ 20.02.2013, 22:17:19
Go to the top of the page
+Quote Post
kuli95
post
Post #3





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 8.07.2012

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


dziękuję (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

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 - 17:00