我的值[关闭]后删除逗号

My query is SELECT $result = mysqli_query($con,"SELECT eemail_email_sub FROM wp_eemail_newsletter_sub GROUP BY eemail_email_sub "); my ouput result is ArbutusHill.BarbraSundquist.dalybakker@gmail.com BradSelers.UniqueArticle.noel56@fatmarketing.com comments@prologicwebsolutions.com GavinBurnham.GavinBurnham.graham.beevis@virgin.net KatieSmith.KatieSmith.rebepa333@yahoo.com TerryStanfield.JuanitaMoreno.seo@clickadvant.com

I want show my result is

ArbutusHill.BarbraSundquist.dalybakker@gmail.com
BradSelers.UniqueArticle.noel56@fatmarketing.com
after again run query is my reslut show next two email
like this

TerryStanfield.LeslieGonzales.seo@clickadvant.com TerryStanfield.MarionMorales.seo@clickadvant.com

not 100% on the logic of your code and if all the relevant lines are there but once you have your variable just trim it.

$variable = 'Assembled Computer Repair & Services,CCTV Cameras,';
$variable = rtrim($variable, ',');

Or you could use substring aswell.

$variable = substr($variable, 0, -1);

Use

$var = "Assembled Computer Repair & Services,CCTV Cameras,";
   $variable = substr(trim($var) , 0, -1);

As martincarlin87 stated, you can use rtrim or substring.

Be aware that rtrim removes all commas at the end of the string, so 'foobar,,' would become 'foobar' instead of 'foobar,'.