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

Unsupported operand types

P: n/a
I keep getting this error:
Fatal error: Unsupported operand types in
/usr/local/etc/httpd/htdocs/djtricities/kat/bpmchart/chart.php on line
58

I've looked for hours for some type of error, and tried lots of
different things, but I can't get it to work. I did a google search
for "unsupported operand types" and for most of the people getting this
error, it was something to do with the version of PHP that they were
running, but I can't change that because it's a shared server from a
hosting company. I'm using PHP version 4.3.11 on Linux. Heres the
program around line 58:
_________________________________
function makeTable($myarray){
$result = "";
for($row = 0; $row < count($myarray); $row++){
$result .= '<tr>';
for($col = 0; $col < count($myarray[$row]); $col++){
$result .= '<td>' . $myarray[$row][$column] . '</td>';
}
$result .= '</tr>';
}
return $result;
}

function bpm($cue, $play){
//if( abs($play - 2 * $cue) < abs($play - $cue) ) $cue = $cue * 2;
//else if( abs(2*$play - $cue) < abs($play -$cue) ) $play = $play *
2;
return ((-100 * ($cue - $play))/$cue); // ***LINE 58***
}
?>
</body></html>

Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
DJ Craig wrote:
I keep getting this error:
Fatal error: Unsupported operand types in
/usr/local/etc/httpd/htdocs/djtricities/kat/bpmchart/chart.php on line
58

I've looked for hours for some type of error, and tried lots of
different things, but I can't get it to work. I did a google search
for "unsupported operand types" and for most of the people getting this
error, it was something to do with the version of PHP that they were
running, but I can't change that because it's a shared server from a
hosting company. I'm using PHP version 4.3.11 on Linux. Heres the
program around line 58:
_________________________________
function makeTable($myarray){
$result = "";
for($row = 0; $row < count($myarray); $row++){
$result .= '<tr>';
for($col = 0; $col < count($myarray[$row]); $col++){
$result .= '<td>' . $myarray[$row][$column] . '</td>';
}
$result .= '</tr>';
}
return $result;
}

function bpm($cue, $play){
//if( abs($play - 2 * $cue) < abs($play - $cue) ) $cue = $cue * 2;
//else if( abs(2*$play - $cue) < abs($play -$cue) ) $play = $play *
2;
return ((-100 * ($cue - $play))/$cue); // ***LINE 58***
}
?>
</body></html>


What's actually in $cue and $play? Try echoing them to see. I suspect
one or both is not numeric.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 17 '05 #2

P: n/a
shouldn't this
$result .= '<td>' . $myarray[$row][$column] . '</td>';
be
$result .= '<td>' . $myarray[$row][$col] . '</td>';

and I assume $cue is not zero
and then both $cue and $play are numerics

what's the code that calls this bpm() function look like ?

DJ Craig wrote:
I keep getting this error:
Fatal error: Unsupported operand types in
/usr/local/etc/httpd/htdocs/djtricities/kat/bpmchart/chart.php on line 58

I've looked for hours for some type of error, and tried lots of
different things, but I can't get it to work. I did a google search
for "unsupported operand types" and for most of the people getting this error, it was something to do with the version of PHP that they were
running, but I can't change that because it's a shared server from a
hosting company. I'm using PHP version 4.3.11 on Linux. Heres the
program around line 58:
_________________________________
function makeTable($myarray){
$result = "";
for($row = 0; $row < count($myarray); $row++){
$result .= '<tr>';
for($col = 0; $col < count($myarray[$row]); $col++){
$result .= '<td>' . $myarray[$row][$column] . '</td>';
}
$result .= '</tr>';
}
return $result;
}

function bpm($cue, $play){
//if( abs($play - 2 * $cue) < abs($play - $cue) ) $cue = $cue * 2;
//else if( abs(2*$play - $cue) < abs($play -$cue) ) $play = $play *
2;
return ((-100 * ($cue - $play))/$cue); // ***LINE 58***
}
?>
</body></html>


Jul 17 '05 #3

P: n/a
Thanks, you were right, I was passing the bpm() function arrays. But I
still can't figure out how they got to be arrays. I used the each()
function in a while loop. Heres the code that calls the function:
while($col = each($cols)){
$rowNum = 0;
while($row = each($rows)){
$result[$rowNum][$colNum] = bpm($row, $col); //$row and $col are both
arrays here for some reason...
echo $result[$rowNum][$colNum] . '-';
$rowNum++;
}
$colNum++;
}
echo '<table>' . makeTable($result) . '</table>';

Jul 17 '05 #4

P: n/a

DJ Craig wrote:
Thanks, you were right, I was passing the bpm() function arrays. But I still can't figure out how they got to be arrays. I used the each()
function in a while loop. Heres the code that calls the function:
while($col = each($cols)){
$rowNum = 0;
while($row = each($rows)){
$result[$rowNum][$colNum] = bpm($row, $col); //$row and $col are both arrays here for some reason...
echo $result[$rowNum][$colNum] . '-';
$rowNum++;
}
$colNum++;
}
echo '<table>' . makeTable($result) . '</table>';


each() returns an array. See the PHP manual.

--
Oli

Jul 17 '05 #5

P: n/a
On 13 May 2005 08:49:34 -0700, Oli Filth wrote:
while($col = each($cols)){


each() returns an array. See the PHP manual.


Yeah, http://php.net/each or try http://php.net/foreach
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #6

P: n/a
Thanks, I've got it working now :-)

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.