Have a issue with comma "," when I am fetching the data if the data for selected id is empty then also the coma(,) shows up what i want is if the data is null or empty the "," should not show up which am unable to do.
say I am selecting the data for
id 1 ,2 ,3
Where for ID 1
Num is 6789
and ID 2
has no Num and id 3 has 12345
$query="SELECT Num FROM euser WHERE UserId IN (SELECT ID FROM master WHERE aa='aa' And cc='cc')" ;
$data=mysqli_query($mysqli,$query)or die(mysqli_error());
$Num = array();
while($row=mysqli_fetch_array($data)){
$Num[] = $row['Num'];
}
$NumStr = implode(',', $Num);
echo $NumStr;
mysqli_close($mysqli);
Present output
6789,,12345
Expecting output
6789,12345