String into array


output je: 7,9,11,14

kakav je dalje postupak da dobijem ovo: 

[code=php]<span class="syntaxdefault">$data</span><span class="syntaxkeyword">=array(</span><span class="syntaxdefault">7</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">9</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">11</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">14</span><span class="syntaxkeyword">);&nbsp;</span><span class="syntaxdefault"></span>[/code]

hvala

output je: 7,9,11,14

kakav je dalje postupak da dobijem ovo:

hvala

tebi treba php.net/implode

[quote=“paor”]<span class="syntaxdefault">$sql&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxstring">"SELECT&nbsp;x&nbsp;FROM&nbsp;`tbl1`&nbsp;&nbsp;"</span><span class="syntaxkeyword">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span class="syntaxdefault">$result&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">mysql_query</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$sql</span><span class="syntaxkeyword">);<br /><br />while(</span><span class="syntaxdefault">$row</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">mysql_fetch_array</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$result</span><span class="syntaxkeyword">))&nbsp;{<br /><br />echo</span><span class="syntaxdefault">$row</span><span class="syntaxkeyword">[</span><span class="syntaxstring">"x"</span><span class="syntaxkeyword">].</span><span class="syntaxstring">","</span><span class="syntaxkeyword">;<br />}&nbsp;</span><span class="syntaxdefault"></span>

output je: 7,9,11,14

kakav je dalje postupak da dobijem ovo:

hvala[/quote]

Prvo rezultat spremi u array, a onda koristi implode za ispis:

A u $x_array imas to sta zelis dobit. :smiley:

hvala

Sad vidim da imam gresku u kodu:


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja