Apache crashes on `name` in the SQL
Posted: Wed Sep 19, 2007 6:33 am
I've had a few times where (locally) Apache would "crash" by a page refusing to load, and then an error window popping up saying that "Apache has encountered a problem..." However, each of these times, I found ways around it by refining my code. The only problem is that I'm now reaching one that makes absolutely no sense. ;_;
I build a query in order to populate my form elements using the databases. The function that I use for this looks like this:
It works fine for all of these:
But Apache crashes on this:
I'm stumped. Anyone know what may be happening?
I build a query in order to populate my form elements using the databases. The function that I use for this looks like this:
Code: Select all
protected function populateFormElement(Vol_Form_Element_Multiple $pElement, $table, $nameColumn, $valueColumn, $orderBy = '', $condition = '')
{
try {
$this->__pSql->query("SELECT
`" . $this->__pSql->escape($nameColumn) . "` AS `name`,
`" . $this->__pSql->escape($valueColumn) . "` AS `value`
FROM
`" . $this->__pSql->escape($table) . "`"
. (!empty($condition) ? " WHERE $condition" : '')
. (!empty($orderBy) ? " ORDER BY $orderBy" : '')
. ";");
while ($data = $this->__pSql->fetchObject()) {
$pElement->addOption($data->name, $data->value);
}
} catch (Vol_Exception $e) {
$pElement->addOption('-- Error --');
// Save the error
$this->log("There was an error populating a form element using the table, '$table,' name column, '$nameColumn,' and value column, '$valueColumn.'", self::LOG_ERROR);
}
return $pElement;
}Code: Select all
$this->populateFormElement($pSystem, 'systems', 'name', 'id', '`id` ASC'); // `id` is in the table
$this->populateFormElement($pSystem, 'systems', 'name', 'id', '`abbr` ASC'); // `abbr` is in the table
$this->populateFormElement($pSystem, 'systems', 'name', 'id', '`value` ASC'); // `value` is not in the table, but an alias from the queryCode: Select all
$this->populateFormElement($pSystem, 'systems', 'name', 'id', '`name` ASC'); // ?????