I have a problem accessing the view field (TotalCost). My code assigns TotalCost as the name for my summation of car and features. Now I want to manipulate the resultant TotalCost. The following is my code and my nonworking solution. Please help.
$Cost = "Select id, car + carfeature1 + carfeature2 + carfeature3 + carfeature4 as TotalCost from testing ORDER BY ID DESC LIMIT 0,1";
$Earning = @mysql_query($Cost,$connection) or die("Couldn't execute select query.");if ($Earning)
{
while ($row = mysql_fetch_array($Earning))
{
echo $row["TotalCost"];
print "<br>\n";
}
}
$tcost = $row[TotalCost];
if ($tcost >= 300)
{
print "Greater than 300";
}
$Cost = "Select id, car + carfeature1 + carfeature2 + carfeature3 + carfeature4 as TotalCost from testing ORDER BY ID DESC LIMIT 0,1";
$Earning = @mysql_query($Cost,$connection) or die("Couldn't execute select query.");if ($Earning)
{
while ($row = mysql_fetch_array($Earning))
{
echo $row["TotalCost"];
print "<br>\n";
}
}
$tcost = $row[TotalCost];
if ($tcost >= 300)
{
print "Greater than 300";
}