jbrill Posted July 19, 2007 Share Posted July 19, 2007 im trying to do a simple multiplication equation with the following: //this is the equation for total hours $sumsql = "SELECT SUM(hours) AS totalhours FROM workhours WHERE jobid=$jobid AND stepid=$stepid;"; $sums = mysql_query($sumsql); $sum = mysql_fetch_array($sums); $totalhours = $sum['totalhours']; // this is to calculate the cost $subcat = $result["subcat"]; $getcost = "SELECT * FROM subcategory WHERE subcat='$subcat'"; $costs = mysql_query($getcost); $cost = mysql_fetch_array($costs); $a = $totalhours; $b = $cost; $total = ($a*$b); echo $total; and it is giving me this error: Fatal error: Unsupported operand types in.... Link to comment https://forums.phpfreaks.com/topic/60854-solved-why-is-this-causing-a-fatal-error/ Share on other sites More sharing options...
chigley Posted July 19, 2007 Share Posted July 19, 2007 Have you tried echo()ing $a and $b to check they're OK? Link to comment https://forums.phpfreaks.com/topic/60854-solved-why-is-this-causing-a-fatal-error/#findComment-302785 Share on other sites More sharing options...
jorgep Posted July 20, 2007 Share Posted July 20, 2007 Are you still having the problem? can you post the whole error message? Link to comment https://forums.phpfreaks.com/topic/60854-solved-why-is-this-causing-a-fatal-error/#findComment-303711 Share on other sites More sharing options...
jbrill Posted July 20, 2007 Author Share Posted July 20, 2007 sorry, .. solved it late at night forgto to check off topic solved Link to comment https://forums.phpfreaks.com/topic/60854-solved-why-is-this-causing-a-fatal-error/#findComment-303713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.