Hello everybody,
I would like to make a very generic INSERT request :
//Player registration
$table=$this->persistent->table;
$fields="`id`,";
$values="NULL,";
foreach($_POST as $name => $input ){
if(!empty($input)){
$fields.="`$name` ,";
$values.="'$input' ,";
}
}
$fields=rtrim($fields,",");
$values=rtrim($values,",");
$this->modelsManager->executeQuery(
"INSERT INTO `$table` ( $fields ) VALUES ( $values ) "
);
But my I got a scanning error, event if the request that it generated is well formed (and works, if I copy paste it in phpmyadmin)
I've tried the raw sql way :
$rawSQL="INSERT INTO `$table` ( $fields ) VALUES ( $values ) ";
$player=new Player();
$request=new Resultset(null,$player,$player->getReadConnection()->query($rawSQL));
Which is even more strange : I got an SQLSTATE[HY000]: General error, but the record works, all fields are well stored in my db ! (But it interrupts my script..)
What am I doing wrong ?
Thanks a lot !