how to translate this answer into my project using a giving basis.
this is the response
mySelectedEvents = {
"2022-09-13": [
{"eventDescp": "11", "eventTitle": "111"},
{"eventDescp": "22", "eventTitle": "22"}
],
"2022-09-30": [
{"eventDescp": "22", "eventTitle": "22"}
],
"2022-09-20": [
{"eventTitle": "ss", "eventDescp": "ss"}
]
};
How to parse and fetch this array ?
CodePudding user response:
You can loop over each item and access it:
for(var event in mySelectedEvents)
{
for(var eventInfo in event)
{
print(eventInfo["eventDescp"]);
print(eventInfo["eventTitle"]);
}
}
CodePudding user response:
this is how i make my bdd . i don't nw how to make the model and make a void function to parse and fetch.
CREATE TABLE `event_date` (
`id` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `event_date`
--
INSERT INTO `event_date` (`id`, `date`) VALUES
(1, '2022-09-13'),
(2, '2022-09-30'),
(3, '2022-09-20');
-- --------------------------------------------------------
--
-- Structure de la table `event_list`
--
CREATE TABLE `event_list` (
`id` int(11) NOT NULL,
`descript` varchar(225) NOT NULL,
`title` varchar(225) NOT NULL,
`id_event_date` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `event_list`
--
INSERT INTO `event_list` (`id`, `descript`, `title`, `id_event_date`) VALUES
(1, '11', '111', 1),
(2, '22', '22', 1),
(3, '22', '22', 2),
(4, 'ss', 'ss', 3);