Chezshire Posted June 23, 2009 Share Posted June 23, 2009 Hello Everyone, I've been googling away trying to solve the follow error and i'm only becoming more and more confused by the examples I'm finding. Can anyone help me to solve this (i'm a newb with little idea of what I'm doing). My code is producing the following error: Warning: Division by zero in /home/content/X/html/xpg/messages/threadX.php on line 225 Line #225: $height = $charimage_size * $size[1] / $size[0]; if ($storyteller) { $height = $charimage_size * $size[1] / $size[0]; $charimage .= "<img src=\"/images/circle-x.jpg\" height=\"$height\" width=\"$charimage_size\" align=\"right\" hspace=\"$charimage_margin\" vspace=\"$charimage_margin\">"; } // end if storyteller Link to comment https://forums.phpfreaks.com/topic/163311-solved-warning-division-by-zero-error-help/ Share on other sites More sharing options...
Ken2k7 Posted June 23, 2009 Share Posted June 23, 2009 $height = $size[0] === 0? 0 : $charimage_size * $size[1] / $size[0]; Link to comment https://forums.phpfreaks.com/topic/163311-solved-warning-division-by-zero-error-help/#findComment-861657 Share on other sites More sharing options...
Chezshire Posted June 25, 2009 Author Share Posted June 25, 2009 Thank you for your assistance Ken2ky, I explored that option and reached this one which solved the problem: echo "<!-- Width: " . $size[0] . ", Height: " . $size[1] . " -->\n"; Link to comment https://forums.phpfreaks.com/topic/163311-solved-warning-division-by-zero-error-help/#findComment-863140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.