Using PhP 4.4.9 and MySQL 5.0.67 if that helps.
What I am trying to do is perform a select from the table for the building levels. There isn't an exact amount of buildings in the table since it can range anywhere from none to about 30 of them per account. Then for each building, figure out what level the building is (anywhere from 1 to 5) and add a certain amount of points for each one.
This code hasn't generated an error, but it doesnt do what I am trying to do. I'v tried using mysql_fetch_assoc, mysql_fetch_array and so forth but I'm not sure if any of it is correct.
Code: Select all
$buildingSelect = sprintf("SELECT buildingLevel FROM building WHERE loginName='%s'", mysql_real_escape_string($_SESSION['loginname']));
$buildingQuery = mysql_query($buildingSelect, $cxn);
while ($checkForTotal = mysql_fetch_assoc($buildingQuery))
{
if ($checkForTotal == 1)
{
$AdditonalPointTotal +=2;
}
else if ($checkForTotal == 2)
{
$AdditonalPointTotal +=6;
}
else if ($checkForTotal == 3)
{
$AdditonalPointTotal +=12;
}
else if ($checkForTotal == 4)
{
$AdditonalPointTotal +=24;
}
else if ($checkForTotal == 5)
{
$AdditonalPointTotal +=48;
}
}