Why are you using the @ symbol that is for error suppression. Where are the variables $clicking_output and $spreading_input? Your trying to multiple values that do not exist. Try this. Also what is the math supposed to be doing? normally math is left to right with anything inside () being done first.
PHP Code:
<?php
function querySuccessful($query)
{
if(!$query)
{
return false;
}
else
{
return true;
}
}
$Q = "SELECT DISTINCT cloth_type AS type FROM clt_transact"; // we only want the three values or how ever many distinct values exist
$runQ = @mysql_query($Q);
if(querySuccessful($runQ))// query ran ok check if anything has been returned now
{
if(@mysql_num_rows($runQ) > 0) // make cloth types an associative array
{
$cloth = @mysql_fetch_assoc($runQ); // creates an associative array
foreach($cloth AS $clothTypes)
{
if($clothTypes == "AAA")
{
// math here
//insert into db code here
}
else if($cloth[type] == "DDD")
{
//math here
//insert into db code here
}
}
}
}
else
{
// query did not run show error
}
?>