1
I have the following code that generates a code of a insert
automatic for me. My system is a kind of generator querys
I’m just passing the parameters. I pass the parameters on a page and give the Submit to send the values to another page, which executes the function and shows the codes already ready.
if($gM)
{
if($gI)
{
foreach ($varUpper as $key)
{
if(!isset($string))
{
$string = "'\".\$this->get$key().\"', <br>";
}
else
{
$string .= "'\".\$this->get$key().\"', <br>";
}
$resultado = substr($string, 0, -6);
}
echo 'protected function insert()<br>{<br>$query = "<br>INSERT INTO '.$tabela.'<br> (<br>'.implode(',<br> ', $colunas).'<br>) <br>VALUES <br>(<br>'.$resultado.'<br>)";';
echo '<br><br>';
echo 'return Dao::getInstancia()->execute($query);<br>}';
}
}
I have this return (Assuming that the table calls "user" and the columns are "use_user", "user_user" and "password_user"):
protected function insert()
{
$query = "
INSERT INTO usuario
(
nome_usuario,
user_usuario,
senha_usuario
)
VALUES
(
'".$this->getNome_Usuario()."',
'".$this->getUser_Usuario()."',
'".$this->getSenha_Usuario()."'
)";
return Dao::getInstancia()->execute($query);
}
However, I would like the return to be so:
protected function insert()
{
$query = "
INSERT INTO usuario
(
nome_usuario,
user_usuario,
senha_usuario
)
VALUES
(
'".$this->getNome_Usuario()."',
'".$this->getUser_Usuario()."',
'".$this->getSenha_Usuario()."'
)";
return Dao::getInstancia()->execute($query);
}
Look at the tabs
which were added, how could I do that? I’ve tried using \t
and show with n2lbr
but it didn’t work.