Closed iwanikhalid closed 3 years ago
I have converted your .txt file to .sql file
Orait sorry tak sempat habiskan lagi. Nak cari the right translation challenging skek
No worries. Takde rush nak kemana pon :P
Hehehe hey can you help me with PHP
$values = get_field('reviewer');
if($values)
{
echo '<ul>';
foreach($values as $value)
{
echo '<li>' . $value['display_name'] . '</li>';
}
echo '</ul>';
}
Macam mana I nak tukar li tu ke list biasa dengan comma je.
Now it appears like
I just want Result 1, Result 2, Result 3
values = get_field('reviewer');
if($values)
{
foreach($values as $value) {
$display .= $value['display_name'] . ‘, ’;
}
echo substr($display, 0, -2);
}
Sorry lambat reply. Dunno if you already solve it but here goes
oh why dia ilang semua indent???
:/
Haha I tulis kat notepad++ and copy paste here
Anyway, the code below didn't seem to work. Tak keluar apa2
$values = get_field('reviewer');
if($values) {
foreach($values as $value) {
$display .= $value['display_name'] . ', ';
}
echo substr($display, 0, -2);
}
i dah fix the code. tatau la kalau tak jadi gak. ekceli tadi silap += sepatutnya .=
Yayy dah work. But then results dia repeating plak eg:
Reviewer(s): Trudie Roberts, Trudie Roberts
Reviewer(s): Trudie Roberts, Trudie Roberts, Richard Hays, Trudie Roberts, Jim McKillop, Mafauzy Mohamed
Any idea why? Kalau tak, I'm just going to use ul li methinks
repeating tu sebab your loop je tu. check the loop
Yayyyyyyyyyyyy I solved it!
$values = get_field('reviewer');
$last = count($values) - 1;
foreach ($values as $i => $row)
{
//$isFirst = ($i == 0);
$isLast = ($i == $last);
if($isLast) :
echo ''. $row['display_name'];
else :
echo $row['display_name'].', ';
endif ;
}
@iwanikhalid u still alive?
Closing issue. If anybody can continue where @iwanikhalid left off, is very much appreciated
I will be doing this soonish insyaAllah
Refs