Add quiz data into database

Hi Folks


Could I insert some data into database like a asset and it can be show on the backend, please?



For example, I check the database and found the asset quiz saved into table "sq_ast_attr_val", "sq_ast_perm" and "sq_ast". And I insert the standard data into those table, but I can not see them on the backend.



Did anyone know it is possible or not?



The SQL language is like this:





INSERT INTO sq_ast_attr_val VALUES('700', 1660, 'quiz 16') ;

INSERT INTO sq_ast_attr_val VALUES('700', 1662, 'question 1?') ;

INSERT INTO sq_ast_attr_val VALUES('700', 1663, ' a:3:{s:1:"a";a:3:{s:4:"text";s:60:"answer 1.";s:6:"points";i:1;s:19:"response_supplement";s:0:"";}s:1:"b";a:3:{s:4:"text";s:108:"answer 2";s:6:"points";i:0;s:19:"response_supplement";s:0:"";}s:1:"c";a:3:{s:4:"text";s:106:"answer 3";s:6:"points";i:0;s:19:"response_supplement";s:0:"";}}') ;

INSERT INTO sq_ast_attr_val VALUES('700', 1664, '1') ;

INSERT INTO sq_ast_attr_val VALUES('700', 1665, '0') ;









INSERT INTO sq_ast_perm VALUES('700', 7, '1', '1') ;





INSERT INTO sq_ast VALUES('700', 'online_quiz_question_multichoice', '0.1.6', 'quiz 16', 'quiz 16', 16, '', '', '0', '2010-02-01 17:09:40', '12', '2010-02-11 09:32:59', '12', '2010-02-02 10:49:15', '12', '2010-02-02 10:49:16', '12') ;





cheers





Fay

:ph34r: did anyone know?

Assuming your data is in the right format (a serialized PHP array), the questions should appear. If they don't, then the data is either in the wrong format, it has not been committed to the DB, or the queries are storing it in the wrong spot.


Looking at your queries, the data does not look correct. Just the first array includes [s:60:"answer 1."] but "answer 1." is not a 60 character string. How did you generate these serialized arrays?



I strongly suggest you do not write question data to the DB directly and instead call the PHP functions the interface does to add/edit/remove questions.



If you really don't want to do that, you are not going to find anyone who has done what you are doing before, so I suggest you run the queries and then make some changes in the admin interface and see if the data you put in has been overwritten. If it has, at least you have the data in the right place, although it must be the wrong format. If it hasn't, then your data is in the wrong place.

[quote]
Assuming your data is in the right format (a serialized PHP array), the questions should appear. If they don't, then the data is either in the wrong format, it has not been committed to the DB, or the queries are storing it in the wrong spot.



Looking at your queries, the data does not look correct. Just the first array includes [s:60:"answer 1."] but "answer 1." is not a 60 character string. How did you generate these serialized arrays?



I strongly suggest you do not write question data to the DB directly and instead call the PHP functions the interface does to add/edit/remove questions.



If you really don't want to do that, you are not going to find anyone who has done what you are doing before, so I suggest you run the queries and then make some changes in the admin interface and see if the data you put in has been overwritten. If it has, at least you have the data in the right place, although it must be the wrong format. If it hasn't, then your data is in the wrong place.

[/quote]





Thanks for you help, I will check them and see what's going on!



cheers