I'm trying to save several objects from predefined data. It saves only first set of data or if I change code it saves data as "array". Here is the code:
<?php
$category = array(
'Account/Profile',
'Blogs',
);
$question = array(
'How do I change my email notifications',
'How do I edit my profile details',
'What is a blog?',
);
$answer = array(
'<p>To change your email notifications</p>',
'<p>To change your profile details</p>',
'<p>A weblog, or blog, is.</p>',
);
$questionCount = count($question);
for ($i = 0; $i <= $questionCount; $i++) {
$faq = new Object();
$faq->category = $category[$i];
$faq->question = $question[$i];
$faq->answer = $answer[$i];
}
$didSave = $faq->save();
How can I pull data from arrays and create multiple objects using that data?