spynode Posted April 9, 2004 Report Share Posted April 9, 2004 Man teiksim ir masiivs $masiivs[0] = jaanis, $masiivs[1] = juris, $masiivs[2] = peeteris. Ka lai izveido mainiigo , kura daljas naak no masiiva. Piem. $mainiigais = "jaanis, juris un peeteris". Link to comment Share on other sites More sharing options...
hu_ha Posted April 9, 2004 Report Share Posted April 9, 2004 nu ja paarveido doto piemeeru, tad tur buutu parastaakaa virknju saskaitiishanas operaacija: $str=$masiivs[0].', '.$masiivs[1].' un '.$masiivs[2]; Link to comment Share on other sites More sharing options...
Robis Posted April 9, 2004 Report Share Posted April 9, 2004 Shaadi: $mainiigais = implode(",", $masiivs); Dos aaraa: "jaanis, juris, peeteris"! Ja vajag ar "un": $elem_skaits = count($masiivs); $mainiigais = ""; for ($i=1; $i<=$elem_skaits; $i++) { if ($i == ($element_skaits-1)) { $mainiigais .= $masiivs[($i-1)]." un "; } elseif ($i==$elem_skaits) { $mainiigais .= $masiivs[($i-1)]; } else { $mainiigais .= $masiivs[($i-1)].", "; } } Link to comment Share on other sites More sharing options...
spynode Posted April 9, 2004 Author Report Share Posted April 9, 2004 Tik vienkaarshi. nu ja. nobremzeeju. labi tnx. Link to comment Share on other sites More sharing options...
spynode Posted April 9, 2004 Author Report Share Posted April 9, 2004 Tad pie reizes vel 2 viegli jautajumi : 1) Kaa lai es dabuunu ciklaa izmestos ierakstus araa no otra gala. Nu tipa augshaa raada jaunaakos komentaarus (peec id), un zemaak vecaakos, nevis otraadi. 2) Kaa lai nodroshina, ka peec skripta izpildes, lapa suuta cilveeku uz citu lapu. Teiksim skripts pievieno komentaaru, un nosuuta cilveeku atpakalj uz galveno lapu. Link to comment Share on other sites More sharing options...
Robis Posted April 9, 2004 Report Share Posted April 9, 2004 Taa: 1) ja tev tie komentaari rakstas datubaazee un teiksim tabulaa `komentaari`: id (uzlikts auto increment) komentaars tad jaataisa vienk shaads query: $query = mysql_query("SELECT * FROM `komentaari` ORDER BY id DESC;"); 2) paarsuutiishana uz citu lapu parasti notiek shaadi: header("Location: ./cita_lapa.php;"); exit(); Nu tur reekjini, ka "./cita_lapa.php" vietaa tev jaaieliek celjsh no pashreizeejaa skripta uz to lapu vai arii pilns celjsh uz to lapu, atkariibaa no saita konfiguraacijas. Link to comment Share on other sites More sharing options...
Recommended Posts