We're sorry, but this discussion has just been closed to further replies.
function write_data ($user, $quiz_name, $correct_answers, $incorrect_answers, $answer_list) { $contentQuery = XN_Query::create('Content');
$contentQuery->filter('type','eic','My Quiz');
$contentQuery->filter('owner');
$contentQuery->filter('my->uid','=',$user);
$results = $contentQuery->execute();
foreach($results as $resultsdata) {
}
$contentObject = XN_Content::load($resultsdata->id);
$contentObject->my->correct += $correct_answers;
$contentObject->my->incorrect += $incorrect_answers;
if ($quiz_name == "test_quiz") {
$contentObject->my->test_quiz = 'true';
$contentObject->my->test_quiz_answers = $answer_list;
}
if ($quiz_name == "test_quiz2") {
$contentObject->my->test_quiz2 = 'true';
$contentObject->my->test_quiz2_answers = $answer_list;
}
$contentObject->save();
}
Fatal error: Uncaught exception 'XN_Exception' with message 'Failed to save content:XN_Content: id [922007:MyQuiz389:1104]
createdDate [2008-03-25T16:07:29.753Z]
updatedDate [2008-03-25T16:07:29.753Z]
type [My Quiz]
title [My Quiz Data]
description []
tagCount [0]
contributorName []
ownerName [Sun Cafe]
ownerUrl [suncafe]
isPrivate [true]
my attributes [
[922007:MyQuiz389:1104-uid-1] uid : 661053464 : string
[922007:MyQuiz389:1104-correct-2] correct : 1 : number
[922007:MyQuiz389:1104-incorrect-3] incorrect : 1 : number
[922007:MyQuiz389:1104-test_quiz2-4] test_quiz2 : true : string
[922007:MyQuiz389:1104-test_quiz2_answers-5] test_quiz2_answers : 1,2 : string
]
<?xml version='1.0' encoding='UTF-8'?>
<errors>
<error code="unknown">Submitted content is incompatible with its shape (My Quiz) in app suncafe. [Attribute my.correct of shape My Quiz has type string which is not compatible with value type Long, Attribute my.incorrect of shape in /php/includes/XN/XN/Exception.php on line 56
$shape = XN_Shape::load('BlogPost');
if ($shape) {
$shape->setAttribute('my.lastViewedOn', 'date');
$shape->save();
}
© 2008 Created by Ning Developer Admin