Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please see the full working example with databasse name <code>test</code> and table <code>table1</code>:</p> <pre><code>&lt;?php $mysqli = new mysqli("localhost", "root", "", "test"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT * FROM table1"; $result = $mysqli-&gt;query($query); while($row = $result-&gt;fetch_row()) { $rows[]=$row['1']; //getting aal country } /* free result set */ $result-&gt;free(); /* close connection */ $mysqli-&gt;close(); ?&gt; &lt;form&gt; &lt;select&gt; &lt;?php foreach ($rows as $mod){?&gt; &lt;option value="&lt;?php echo $mod?&gt;"&gt;&lt;?php echo $mod?&gt;&lt;/option&gt; &lt;?php }?&gt; &lt;/select&gt; &lt;/form&gt; &lt;?php $all_country = array(); foreach ($rows as $mod){ $arr = explode(',', $mod); foreach($arr as $row){ if(trim($row) != '') $all_country[] = trim($row); } } $input = array(); $input = array_unique($all_country); ?&gt; &lt;form&gt; &lt;select&gt; &lt;?php foreach ($input as $mod){?&gt; &lt;option value="&lt;?php echo $mod?&gt;"&gt;&lt;?php echo $mod?&gt;&lt;/option&gt; &lt;?php }?&gt; &lt;/select&gt; &lt;/form&gt; </code></pre> <p>This is result: note that Uk and UK have uper and lower case problem else it is unique.</p> <pre><code>Simple data: Array ( [0] =&gt; India [1] =&gt; Usa [2] =&gt; Germany [4] =&gt; usa [6] =&gt; Uk [8] =&gt; UK ) unique country; Array ( [0] =&gt; India [1] =&gt; Usa [2] =&gt; Germany [4] =&gt; usa [6] =&gt; Uk [8] =&gt; UK ) </code></pre>
 

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