I am attempting to execute a php query with no results. I have been trying to get it to work for hours and figure another set of eyes would be helpful. Here is my script:
if(!empty($cLvl))
{
$result = $conn->query("SELECT lvl" . $cLvl . "
FROM buyers WHERE buyer_id = $buyer");
$comRate = $result->fetch_assoc();
}
print_r($comRate); die;
$buyer
is found by:
$result = $conn->query("select source_id from inventory where sku = {$data[$n]['sku']}");
if($result) {$buyer = $result->fetch_assoc();}
and $cLvl
is found by:
if($data[$n]['cost'] == 0 || $bookType3['book_type_3'] == "DMG")
{
$cLvl = null;
}
elseif($bookType['book_code'] == "IE" || $bookType['book_code'] == "AIE")
{
$cLvl = 3;
}
elseif($cId['condition_id'] == 1 || $cId['condition_id'] == 2 || $cId['condition_id'] == 3 || $cId['condition_id'] == 4 || $follett['class_code'] == "D" || strpos($follett['notes'],"(T)") == true)
{
$cLvl = 2;
}
elseif($cId['condition_id'] == 5)
{
$cLvl = 1;
}
in my testing $buyer = 263
and $cLvl = 3
. However when I try to find $comRate
, it returns nothing. If I hard code in the information I get a result, but this is going to run about 250 records and I can't be hardcoding each one.
Where am I going wrong with this??