2 Replies - 1525 Views - Last Post: 04 April 2001 - 07:17 PM Rate Topic: -----

#1 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

PHP

Posted 04 April 2001 - 06:06 PM

$question[1] = "Question";
$answera[1] = "Answer A";
$answerb[1] = "Answer B";
$answerc[1] = "Answer C";
$correct[1] = "c";

$question[2] = "Another Question";
$answera[2] = "Answer A";
$answerb[2] = "Answer B";
$answerc[2] = "Answer C";
$correct[2] = "c";

...

for($i=1;$i<10;$i++){
$set[$i] = array($question[$i], $answera[$i], $answerb[$i], $answerc[$i], $correct[$i]);
$set[$i] = implode ("
- ", $set[$i]);
$allsets = $allsets + $set[$i];
}

how can that end up as "0"?  it just makes no sense! i know i did something wrong, what is it?


Is This A Good Question/Topic? 0
  • +

Replies To: PHP

#2 Quik  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2
  • View blog
  • Posts: 3,750
  • Joined: 06-March 01

Re: PHP

Posted 04 April 2001 - 07:02 PM

I dont know PHP one bit but i am similiar to code so can u use a if statement? so if to variables match another variable is plus 1. so like

if $answera = $correct
$total = $total + 1
else
$total = $total
end if

that means if question and answer matches total will be plus 1 if answer is wrong total remains the same.
If this or somthing similiar to what i sayed works im gonna start using PHP!

Was This Post Helpful? 0
  • +
  • -

#3 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

Re: PHP

Posted 04 April 2001 - 07:17 PM

no thats not what i'm looking to do

for($i=1;$i<10;$i++){
$set[$i] = array($question[$i], $answera[$i], $answerb[$i], $answerc[$i], $correct[$i]);
$set[$i] = implode ("
- ", $set[$i]);
$allsets = $allsets + $set[$i];
}

this says to process some actions over and over until a condition is no longer true.  it has to do with arrays. each time the code runs, it is supposed to process a different array.

i'll just change stuff until it works, thanks for trying

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1