Why do I keep getting this error: ?
Fatal error: Cannot use string offset as an array in /var/www/files/transcode.ca/wh33t/surveytool/surveyresults.php on line 34
I'm trying to use... I'm not even sure what they are called. But its when you use the second field of the array. I'm probably not even doing this right. Basically I have an array, and the first column (if thats what they are called) $array[firstcolumn] contains 27 records and many of them are the same. I am trying to write a script that finds out how many different records there are. So in this case there is only three differences, Central, South End or North End. So I want my script to count how many of each. So what I'm trying to do is a foreach loop. Observe:
Code:
foreach($array as $values)
{
if(isset($values[$a]))
{
$values[$a][amount]++;
} else {
$values[$a][amount]=1;
}
$a++;
}
So I'm trying to make the second field hold the amount of times the value Central or North end etc... appears.. Am I going about this totally wrong and wtf is up with that error message?