Hi to all... this is simply my very first problem that I am about to consult with you guys...
This is totally not an assignment of mine or whatsoever I just need this to run my demo website for my CAI project that I am about to propose to my school....
Heres the situation...
I had a database here with fields
ID - ExamName - TopicCode - SubjectCode - ExamContents - Published
the main problem here is that I do not know what particular process am I going to use regarding the processing of the contents of the 'ExamContents' field and display the particular 'Question entry' from the database'...
lets say that ExamContents has this content...
1:4-7-12-16-18-25,3:25-54-67-90-105,2:38-43-72-87-90
1, the first character followed by a colon denotes the type of exam, lets say Identification and the numbers next to it separated by dashes were the 'IDs' from the question bank.... so is the second one 3: that denotes Modified True or false type and 2: denotes Debugging....
what my problem now is that I do not know what specific string functions are going to be used to make an output like these...
QUOTE
Identification:
QuestionItem that has the ID of 4
QuestionItem that has the ID of 7
QuestionItem that has the ID of 12
QuestionItem that has the ID of 16
QuestionItem that has the ID of 18
QuestionItem that has the ID of 25
Modified True of False:
QuestionItem that has the ID of 25
QuestionItem that has the ID of 54
QuestionItem that has the ID of 67
QuestionItem that has the ID of 90
QuestionItem that has the ID of 105
Debugging:
QuestionItem that has the ID of 38
QuestionItem that has the ID of 43
QuestionItem that has the ID of 72
QuestionItem that has the ID of 87
QuestionItem that has the ID of 90
I just guessed the following code to show this stuff
CODE
<?php
...
$result = mysql_query($query) or die('There was an error regarding the connection to the database. Please try again');
while ($row = mysql_fetch_assoc($result)) {
$QuestionSet = $row['QuestionContent'];
}
$QuestionContentSize = strlen($QuestionSet);
$StringIndex = 0;
while (isset($QuestionSet{$StringIndex})) {
$data[$nr] = $string{$nr};
$nr++;
}
for($i=$StringIndex;$i<$QuestionContentSize;$i++) {
$query[$i] = "Select Question from exambank WHERE ID = '$data[$i]'";
$result[$i] = mysql_query($query[$i]) or die('Unable to download questions. Try again.');
while ($row = mysql_fetch_assoc($result[$i])) {
$Question = $row['Question'];
}
echo '$Question';
}
?>
This is just I know but it is 100% sure it wont work...
I already can break down the string contents into an array but I do not know what it will do next when the array contents is a : or a - an a ,
Can someone revise this?
Please???
This post has been edited by aco99: 5 Mar, 2008 - 09:22 PM