I imagine this simply a php formatting issue, but I can’t seem to figure it out at the moment. In the db selections below, the first select statement works fine.
$result = $modx->db->select("unit_price","vtigercrm504.vtiger_products","productcode = \"$partnumber\" && unit_price > 0");
But I have several other queries that are are more complex, so I’d like to use an actual query. This works fine with $partumber hard coded
$result = $modx->db->query('SELECT unit_price FROM vtigercrm504.vtiger_products WHERE productcode = "123456" && unit_price > 0 ');
But when I try to use the variable $partnumber (passed correctly and verified), I get no results. $partnumber seems to not be getting evaulated correctly. I suspect this is a problem with the way $partumber is referenced, but I’ve tried several combinations of single, double quotes and parenthesis and can’t figure out how to get it to work.
$result = $modx->db->query('SELECT unit_price FROM vtigercrm504.vtiger_products WHERE productcode = "$partnumber" && unit_price > 0 ');