php - Retrieve data from a database and separate the data when we get a delimiter? -
i have table 2 columns first column id , second column list of form :
productid:3,productname:eggbiryani,quantity1price:100; productid:5,productname:vegetable biryani,quantity1price:100; productid:10,productname:special vegetable biryani,quantity1price:130;
when retrieving column need place \n instead of ;. need send data via mail not clear identification if include \n in place of ; data after /n come next line data clear.thanks in advance
in javascript:
var newcol2 = oldcol2.replace(/;/, "\n");
or
var arycol2 = oldcol2.split(';');
in php:
$newcol2 = str_replace(";", "\n", $oldcol2);
or
$arycol2 = explode(';', $oldcol2);
references: explode , str_replace php manual.
Comments
Post a Comment