I have an SQL query here wherein it returns Notice: Undefined index: sbvip
because i'm using SELECT DISTINCT, I can't query the other columns I need to avoid duplicate records thats why I used DISTINCT.
meanwhile, when I use SELECT * , there are no errors but duplicate records are showing..
below is my sql query
function setvip_sportsbook_model(){
//connect to the server
$conn= mysqli_connect("localhost","root","","people");
//check the connection
if(mysqli_connect_errno($conn)){
echo "Error";
}
else{
//echo "connect Ok";
}
//prepare the sql
$sql= "SELECT DISTINCT merchant_name FROM merchants2";
//execute query
$result= mysqli_query($conn,$sql);
//process result
if($myrow = mysqli_fetch_array($result)){
$record = array();
do{
$info['merchant_name']=$myrow['merchant_name'];
$info['sbvip']=$myrow['sbvip'];
$record[] = $info;
}while($myrow = mysqli_fetch_array($result));
}
return $record;
}
can help me what query i need to do for the sbvip? thank you a lot