Multiple entry in one mysql cell and Json data -
i have lots folder named series name. , every series folder has own chapter folder. in chapter folder images in it. website manga(comic) site. gonna record folder's , image's path mysql , return json data using angularjs. how should save these folders path or names mysql proper json data , using angularjs.
my table this: can change,
id series_name folder path 1 dragon ball 788 01.jpg02.jpg03.jpg04.jpg05.jpg06.jpg.......... 2 1 piece 332 01.jpg................... 3 1 pÄ°ece 333 01.jpg02.jpg...........
my current website: link reader part of website
i'm assuming you're using php on lamp stack. first need grab sql fields , change them json keys.
create json-object correct way
then can create json object , pass angular when ajax request. make sure create array before placing json object (for path).
{ id: number, series_name: string, folder: number, path: [ string, string, string, ... ] }
here angular documentation angular request.
https://docs.angularjs.org/api/ng/service/$http
edit:
it's difficult because of how filenames formatted. if formatted "01.jpg,02.jpg,03.jpg" easier.
you can use preg_split regex:
$string = "01.jpg02.jpg03.jpg04.jpg05.jpg06.jpg"; $keywords = preg_split("/(.jpg|.png|.bmp)/", $string);
but need them same extension, need re-append extension each element after split it.
there may better way.
Comments
Post a Comment