Bizarre PHP error: function not recognizing its own parameter
I have the following function:
public function updateCustomerInternetBanking($value, $column_to_go_by)
{
$sql = "
UPDATE customer c
JOIN account_import ai ON c.account_import_id = ai.id
JOIN generic_import gi ON ai.generic_import_id = gi.id
JOIN import_bundle ib ON gi.import_bundle_id = ib.id
SET has_internet_banking = 1
WHERE c.".$column_to_go_by." = ".$this->quote($value)."
AND ib.id = ".$this->quote($this->getId())."
";
$conn = Doctrine_Manager::connection();
$conn->execute($sql);
}
When I try to run it in development, it works fine. When I try to run it in production, I get this:
PHP Notice: Undefined variable: column_to_go_by in /var/www/mci开发者_运维百科f/lib/model/doctrine/ImportBundle.class.php on line 655
How could $column_to_go_by
be undefined?!
And just so you know, this code is copied straight from production and I checked that the WHERE
... line is line 655.
Are you sure you are passing both variables correctly?
A method call like this:
updateCustomerInternetBanking(999);
would produce this kind of error.
精彩评论