Good afternoon,
Background Information:
The client hosting server is being upgraded from PHP 5.2 to PHP 5.3. The client application breaks when testing in PHP 5.3. In particular, insert and update methods are those that violate the application. The application is encoded in Zend Framework v1.7.2.
We tried just updating the core of the Zend Framework, however, it seems that previous developers made changes to the kernel, which causes the application to crash completely when the infrastructure was updated.
Problem
The best solution was to add a class called AppModel that extends Zend_Db_Table_Abstract and then simply overwrites the insert and update methods. All models in this application extend the AppModel class. This works fine until the flag data or radio button data is written to the database.
The application now throws the following error:
Fatal error: throw exception "Zend_Db_Statement_Exception" with message 'Invalid bind variable name': 1 '' in ....
NB. Full error message below
. , , Mysqli Pdo_Mysql. , , . Pdo, , Mysqli.
, !
. , , .
AppModel:
class AppModel extends Zend_Db_Table_Abstract{
public function insert(array $data) {
$ins_data = array();
foreach($data as $table => $value){
$ins_data['tables'][] = $table;
$ins_data['values'][] = mysql_escape_string($value);
}
$db = Zend_Registry::get('db');
$ins_query = ' INSERT INTO '. $this->_name.' ('.implode($ins_data['tables'], ', ').')
VALUES ("'.implode($ins_data['values'], '", "').'")';
$ins_action = new Zend_Db_Statement_Mysqli($db, $ins_query);
$ins_action->execute();
return $db->lastInsertId();
}
}
:
Fatal error:
Uncaught exception 'Zend_Db_Statement_Exception'
with message 'Invalid bind-variable name ':1''
in C:\wamp\www\schoolnet\public_html\Zend\Db\Statement.php:143
Stack trace: