How do I remove the duplicates? I have 4 rows in my database table with all the same name, for example a brand, Apple, which is used 4 times, how do i remove the other duplicates with the same name? this is to avoid redundancy when inputing brands.
<script>
$(document).ready(function(){
$("#prod_brand").autocomplete("prod_brand_auto_complete.php", {
selectFirst: true
});
});
</script>
Here is the prod_brand_autocomplete.php
<?php
$q=$_GET['q'];
$my_data=mysql_real_escape_string($q);
$mysqli=mysqli_connect('localhost','root','12148qx3er','buybranded') or die("Database Error");
$sql="SELECT prod_brand FROM inventory WHERE prod_brand LIKE '%$my_data%' ORDER BY prod_brand";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error());
if($result)
{
while($row=mysqli_fetch_array($result))
{
echo $row['prod_brand']."\n";
}
}
?>