![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 127 Pomógł: 6 Dołączył: 26.07.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam, otóż mam jeden plik functions.php i index.php.
W functions.php napisałem sobie taką funkcję : CODE function pokazTematy(){ $sql="SELECT * FROM `forum_tematy` "; $result=mysql_query($sql) or die(mysql_error()); $row=mysql_fetch_array($result); return $row; } W index.php includuje , łączę się z bazą danych , wybieram bazę przypisuję zmiennej $tab=pokazTematy(); no i właśnie i dalej mam problem .... Próbowałem while ale udaje mi się wyciągnąć tylko jedno pole i to w nieskończoność ...(nie mogę np. napisać w środku pętli while $tab=mysql_fetch_array($result); bo nie ma takiej zmiennej ) Zaś pętlą foreach zwrócę tylko jeden rekord ... Nie mam pojęcia jak to zrobić i nie wiem czy w ogóle się da tak zrobić czy od razu w funkcji trzeba wyciągać dane , pomoże ktoś ? Ten post edytował kamillo121 26.07.2009, 19:10:29 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 127 Pomógł: 6 Dołączył: 26.07.2009 Ostrzeżenie: (0%) ![]() ![]() |
czyli np
wyciągnąć np funkcję przypiszę do zmiennej $tab while($tab ){ $tytul->assign['tytul']=$tab['tytul']; $autor->assign['autor_tem']=$tab['autor_tem']; $data->assign['data_dodania']=$tab['data_dodania']; } I potem każda pętla dla każdej tabeli ? jeżeli całkiem wszystko pokręciłem to przepraszam ale już o to pytałem i mam tak namieszane że hej (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Po var_dump mam array(10) { [0]=> string(1) "1" ["id"]=> string(1) "1" [1]=> string(9) "Regulamin" ["tytul"]=> string(9) "Regulamin" [2]=> string(7) "Kamillo" ["autor_tem"]=> string(7) "Kamillo" [3]=> string(19) "2009-07-26 00:21:00" ["data_dodania"]=> string(19) "2009-07-26 00:21:00" [4]=> string(29) "Regulamin : 1 2 3 4 5 6" ["watek"]=> string(29) "Regulamin : 1 2 3 4 5 6" } Ten post edytował kamillo121 26.07.2009, 19:17:48 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.10.2025 - 09:24 |