Note that there are some explanatory texts on larger screens.

plurals
  1. POPrint results with unique names
    primarykey
    data
    text
    <p>I have the below function:</p> <pre><code>function getStoresDisplay($data, $page_number, $nb_display) { $nb_stores = $data['nb_stores']; $list = $data['list']; $current_address = $data['address']; if($current_address=='') $current_address_display = '&amp;nbsp;'; else $current_address_display=$current_address; $display .= '&lt;ul data-role="listview" data-theme="d"&gt;'; $display .= '&lt;li data-role="list-divider" data-theme="a"&gt;'.$current_address_display.'&lt;span class="ui-li-count"&gt;'.$nb_stores.'&lt;/span&gt;&lt;/li&gt;'; for($i=0; $i&lt;count($list); $i++) { $id = $list[$i]['id']; $name = $list[$i]['name']; $logo = $list[$i]['logo']; $address = $list[$i]['address']; $distance = $list[$i]['distance']; $created = $list[$i]['created']; $display .= '&lt;li&gt;&lt;a href="javascript:" class="displayStoreDetails" id="'.$id.'"&gt;'; if($logo!='') $display .= '&lt;img src="'.$logo.'" style="margin-top:18px;"&gt;'; $display .= '&lt;h3&gt;'.$name; $display .= '&lt;/h3&gt;'; //if($current_address!='') $display .= '&lt;span class="ui-li-count"&gt;&lt;font color="red"&gt;&lt;small&gt;'.ceil($distance).' '.$GLOBALS['distance_unit'].'&lt;/small&gt;&lt;/font&gt;&lt;/span&gt;'; $display .= '&lt;p&gt;'.$address.'&lt;/p&gt;'; if($current_address!='') $display .= '&lt;p&gt;&lt;small&gt;Dista da te: &lt;/small&gt;&lt;font color="red"&gt;&lt;small&gt;'.ceil($distance).' '.$GLOBALS['distance_unit'].'&lt;/small&gt;&lt;/font&gt;&lt;/p&gt;'; $display .= '&lt;/a&gt;&lt;/li&gt;'; } $display .= '&lt;/ul&gt;&lt;br&gt;'; $display .= '&lt;div data-role="controlgroup" data-type="horizontal" data-theme="a" style="text-align:right;" &gt;'; if($page_number&gt;1) $display .= '&lt;a href="javascript:" id="displayStoresListNextPreviousBtn" page_number="'.($page_number-1).'" data-role="button" data-icon="arrow-l" data-theme="d"&gt;Previous&lt;/a&gt;'; $display .= '&lt;a href="javascript:" data-role="button" data-theme="d"&gt;&lt;span id="pageNumberReload"&gt;'.$page_number.'&lt;/span&gt;&lt;/a&gt;'; if($nb_stores&gt;($page_number*$nb_display)) $display .= '&lt;a href="javascript:" id="displayStoresListNextPreviousBtn" page_number="'.($page_number+1).'" data-role="button" data-icon="arrow-r" data-theme="d"&gt;Next&lt;/a&gt;'; $display .= '&lt;/div&gt;'; return $display; </code></pre> <p>I want that it will print only results with unique names ( <code>$name = $list[$i]['name'];</code> ). I have same item in different categories, so I want that it should not print duplicate items with same name.</p> <p>How can I do this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload