andrisp Posted October 1, 2008 Report Share Posted October 1, 2008 (edited) Saproti - tu jau šajās rindās dari nepareizi: ... $string = mysql_query("SELECT keywords FROM prece"); $stringsql = mysql_fetch_array($string); foreach ($stringsql as $tagu_strings) { ... Sanāk tā, ka tu ciklē cauri tikai pirmā ieraksta laukiem (šajā gadijumā vienam laukam). Tas, ko tev vajag, ir šādi: <?php $all_tags = array(); $result = mysql_query("SELECT keywords FROM prece"); while ($row = mysql_fetch_assoc($result)) { $all_tags = array_unique(array_merge($all_tags, explode(',', $row['keywords']))); } print_r($all_tags); ?> Es gan kodu nepārbaudīju, tāpēc varbūt kāds typo. Edited October 2, 2008 by andrisp Link to comment Share on other sites More sharing options...
Blackout Posted October 1, 2008 Author Report Share Posted October 1, 2008 Liels, paldies..! :) Biju darijis tā pat kā tu, bet apskaidrību man deva tas print_r, jo ar echo un print izvadija: array, array, array.. tagad pielaboju un viss ir ok.. :) Paldies.. Link to comment Share on other sites More sharing options...
andrisp Posted October 2, 2008 Report Share Posted October 2, 2008 Hmm, vispār es pieļāvu kļūdu. while tur vajadzīgs nevis foreach. Link to comment Share on other sites More sharing options...
Blackout Posted October 2, 2008 Author Report Share Posted October 2, 2008 zinu, zinu.. :) To es izlaboju.. Es biju apmēram tā pat uzrakstijis.. tikai no $all_tags nevarēju dabūt ārā.. Paldies..! :) Link to comment Share on other sites More sharing options...
foxsk8 Posted October 3, 2008 Report Share Posted October 3, 2008 Būs laiks uzcepšu tev strādājošu piemēru. Ir jau iesākts, tikai vajag to priekš tagiem pielāgot. Link to comment Share on other sites More sharing options...
Blackout Posted October 3, 2008 Author Report Share Posted October 3, 2008 Nē, paldies, nevajag.. Viss jau ir uztaisīts.. ;) Link to comment Share on other sites More sharing options...
Recommended Posts