Jump to content

Where The Heck Is It Dividing By 0? 0o


Greywacke

Recommended Posts

hi,i am currently struggling to see the worms in the apple. could i perhaps please ask outside assistance, i've tried googling on this error but have found only unrelated examples of this error. i don't see any divisions in these few lines of code.here is the error i receive:

Warning: Division by zero in /home/dwtphovu/public_html/ferrety/fab/public/request_canopyxchange.php on line 144Warning: Division by zero in /home/dwtphovu/public_html/ferrety/fab/public/request_canopyxchange.php on line 144
and here is the function that contains line 144, the line is made bold:
function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too?	$sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";";	$GLOBALS["sql"] .= $sql;	$result = mysql_query($sql);	$err = mysql_error();	$GLOBALS["sql"] .= strtoupper($err)."\n";	if ($row = mysql_fetch_array($result)) {		$dd = $row["smallint_DuplicateDays"];	}	[i]$ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),"-".$dd." days"));[/i]	[b]$sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer 	LIKE "%".$mail."%" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > ".$ddate." ORDER BY 	timestamp_LeadCreated DESC;";[/b]	$GLOBALS["sql"] .= $sql;	$result = mysql_query($sql);	$err = mysql_error();	$GLOBALS["sql"] .= strtoupper($err)."\n";	if ($result) {		$leadids = array();		while ($row = mysql_fetch_array($result)) {			array_push($leadids,"#".($row["bigint_LeadID"]+11001000));		}		return " (".join(", ",$leadids).")";	} else {		return "";	}}

this function is to get a string to append to the subject of the mailed leads IF it is a duplicate lead within the amount of days specified in the database.smallint_DuplicateDays is equal to 30 for bigint_ServiceID 1.i suspect the problem might be elsewhere, possibly in the line that i made italic, which would mean this is quite possibly a displaced error.

Link to comment
Share on other sites

yeah, just fixed it, read through the sql string to notice that the wildcards where being read as mod's. :/just had to escape the quotes :)so it was not a displaced error ^^

function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too?	$sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";";	$GLOBALS["sql"] .= $sql;	$result = mysql_query($sql);	$err = mysql_error();	$GLOBALS["sql"] .= strtoupper($err)."\n";	if ($row = mysql_fetch_array($result)) {		$dd = $row["smallint_DuplicateDays"];	}	$ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),$dd." days ago"));	$sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer LIKE \"%".$mail."%\" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > ".$ddate." ORDER BY timestamp_LeadCreated DESC;";	$GLOBALS["sql"] .= $sql;	$result = mysql_query($sql);	$err = mysql_error();	$GLOBALS["sql"] .= strtoupper($err)."\n";	if ($result) {		$leadids = array();		while ($row = mysql_fetch_array($result)) {			array_push($leadids,"#".($row["bigint_LeadID"]+11001000));		}		return " (".join(", ",$leadids).")";	} else {		return "";	}}

:)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...