...

View Full Version : code disorder help



Festum
03-29-2010, 07:49 AM
I have a code for converting some database cells to comparing operators
but not so good. Could someone give me ideas or help me to shorten this code?

thanks a lot:)



function comparing($temp, $input, $outcomeId, $temp2=0){
if($temp2==0){
if($temp['operator']==0)
if($input['value']==$temp['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp['operator']==2)
if($input['value']<$temp['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp['operator']==3)
if($input['value']>$temp['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp['operator']==4)
if($input['value']<=$temp['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp['operator']==5)
if($input['value']>=$temp['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
}else{
if($temp['operator']==2){
if($temp2['operator']==3)
if($input['value']<$temp['value']&&$input['value']>$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp2['operator']==5)
if($input['value']<$temp['value']&&$input['value']>=$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
}
if($temp['operator']==3){
if($temp2['operator']==2)
if($input['value']>$temp['value']&&$input['value']<$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp2['operator']==4)
if($input['value']>$temp['value']&&$input['value']<=$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
}
if($temp['operator']==4){
if($temp2['operator']==3)
if($input['value']<=$temp['value']&&$input['value']>$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp2['operator']==5)
if($input['value']<=$temp['value']&&$input['value']>=$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
}
if($temp['operator']==5){
if($temp2['operator']==2)
if($input['value']>=$temp['value']&&$input['value']<$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
if($temp2['operator']==4)
if($input['value']>=$temp['value']&&$input['value']<=$temp2['value'])
$sql=insertAppender($sql, $input['id'], $outcomeId);
}
}
mysql_query($sql);
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum