![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 88 Pomógł: 0 Dołączył: 22.04.2002 Ostrzeżenie: (0%) ![]() ![]() |
Ma taki oto skrypt newsowywyswietlajacy 10 najnowszych newsow:
$ncnt=mysql_fetch_array(sql("select max(id) from news;")); $max=$ncnt[0]; for($i=1;$i<=10;$i++) { $topic=mysql_fetch_array(sql("select $g1 from news where id = $max")); $msg=mysql_fetch_array(sql("select $g2 from news where id = $max")); $aut=mysql_fetch_array(sql("select aut from news where id = $max")); $tdate=mysql_fetch_array(sql("select dat from news where id = $max")); if($topic[0]!="") { echo(iso("<span class="topic">$topic[0]</span><br>")); echo(iso("<span class="text2">$tdate[0]</span><br><br>")); echo(iso("<span class="text2">$msg[0]</span><br>")); echo(iso("<p class="sign">$aut[0]</p>")); } $max--; } Funkcje sql zdefiniowalem, wszystko jest OK tylko ze mam problem ze zmienna $msg Otoz kiedy robie echo($msg); to wyswietla mi sie "Array" - prawidlowo, ale kiedy mam $msg[0] to nie widze nic... W czym problem, moze text do pobrania z bazy jest za dlugi? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Przyjaciele php.pl Postów: 2 335 Pomógł: 6 Dołączył: 7.03.2002 Ostrzeżenie: (0%) ![]() ![]() |
Cytat $topic=mysql_fetch_array(sql("select $g1 from news where id = $max"));
$msg=mysql_fetch_array(sql("select $g2 from news where id = $max")); $aut=mysql_fetch_array(sql("select aut from news where id = $max")); $tdate=mysql_fetch_array(sql("select dat from news where id = $max")); A nie lepiej napisac to tak: Kod $sqlarray = mysql_fetch_array(sql("select * from news where id = $max");
$topic = $sqlarray['$g1']; $msg = $sqlarray['$g2']; $aut = $sqlarray['aut']; $tdate = $sqlarray['dat']; |
|
|
![]() ![]() |
![]() |
Aktualny czas: 4.10.2025 - 15:16 |