By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,085 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

Fatal Error: Unsupported operand types.

P: 5
I'm a beginner at php and studying at a university.

I need to write a script which outputs the $afdeling and the corresponding "summed up" $omzet.

Then I need to output the $afdeling that has the most $omzet. //Don''t have this yet.

I wrote this using an example explaining a similar thing.

Since, I'm a beginner I can't find the error or know what is wrong.

I'm getting the error around on line 12.
This is what I have uptil now.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $omzet[0] = array(10, 13, 16, 9, 19, 18);     
  3.     $omzet[1] = array(9, 12, 18, 6, 21, 11);    
  4.     $omzet[2] = array(6, 5, 8, 17, 15, 20);
  5.     $omzet[3] = array(13, 12, 15, 23, 19, 22);
  6.     $omzet[4] = array(11, 11, 11, 16, 7, 14);
  7.     $omzet[5] = array(14, 14, 13, 18, 9, 20);
  8.     $afdeling = 1;
  9.     for($i=0; $i<6; $i++){    
  10.         $totaal = 0;    
  11.         while($omzet[$i] <> 99){
  12.             $totaal = $totaal + $omzet[$i];
  13.         }
  14.     $totaal = $totaal;
  15.     echo "Het totale omzet bedrag van afdeling " .$afdeling. " is " .$totaal. ". \n";
  16.     $afdeling = $afdeling + 1;
  17.     }
  18. ?>

Thanks in advance for the help.
Sep 23 '11 #1

✓ answered by zero 0

YES, got the first error. Had to put in the array, from the first 6 variables, ", 99" as the last number, else it couldnt use the "not equal"-operator I guess.. xD
Now for echo-ing the $afdeling with the highest value. :)

Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,366
The not equal operator is !=
Sep 23 '11 #2

P: 5
That's not the error.
not equal can be written like != or <>
Sep 23 '11 #3

P: 5
YES, got the first error. Had to put in the array, from the first 6 variables, ", 99" as the last number, else it couldnt use the "not equal"-operator I guess.. xD
Now for echo-ing the $afdeling with the highest value. :)
Sep 23 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.