i have values in database (shah,zn,khoo,mm,) but i dont know how to display it
$sellerquery = mysqli_query($con, "select * from partydetails where id='$seller_id'") or die(mysqli_error($con));
$sellerdata = mysqli_fetch_array($sellerquery);
echo $sellerdata['name']; ?>
output will be
shah,zn,khoo,mm
CodePudding user response:
You have to use Implode Function
Ref: https://www.php.net/manual/en/function.implode.php https://www.w3schools.com/php/func_string_implode.asp
$sellerdataString = implode(',', $sellerdata['name']);
if Multidimentional Array then
$sellerdataString = implode(',', array_column($sellerdata, 'name'));
CodePudding user response:
while($sellerdata = mysqli_fetch_array($sellerquery, MYSQLI_ASSOC))
{
print $sellerdata;
}