how is this a MySQL issue, I don't see any select query retrieving a vlaue for cloth_type?
my suspisicion is that $cloth_type is not populated.
debugging PHP scripts can be a beggar especially if you don't use soemthing like eclipse.
what I'd suggest you do is use a brute force approach and either write the state of variable to a common debug variable, or write the debug bessages to a file and or make frequent use of the die statement.
variable approach
PHP Code:
$debugVar = "Cloth Type:".$cloth_type."<BR>";
$debugVar .= "Input Qty:".$input_qty."<BR>";
$debugVar .= "Output Qty:".$output_qty."<BR>";
if($cloth_type == 'AAA' or $cloth_type == 'BBB' or $cloth_type == 'CCC') {
$input_qty = $input_qty * 14.15;
$output_qty = $output_qty * 14.15;
}
else{
$input_qty = $input_qty * 15.85;
$output_qty = $output_qty * 15.85;
}
$debugvar .= "-----------------------------------";
$debugVar .= "Input Qty:".$input_qty."<BR>";
$debugVar .= "Output Qty:".$output_qty."<BR>";
die echo $debugVar;
incidentally I'd strongly advise you not to use magic numbers such as 14.15 or 15.85.even if they are constants and are never ever going to change. if they truly are constants then give 'em a name such as typeblahconversion, although PHP coding standards suggest you should use the define statement and use uppercase
personally I think you should have a table which encodes these conversion factors so that if the user wants to defien a new product type they can do so without any program change. history says the user will often do this sort of thing, then complain to you that your program is broken becuase they've introduced a new product type with a new conversion fact, and invariably its at no notice when you are busy on other things.
so I'd suggest a new table
defining the cloth types, the input conversion factor, and output factor if its ever likely to be different and pull those values in as required