I have the following code that generates one the% auto_codes for me. My system is a kind of insert
generator already ready, just step the parameters. I pass the parameters on a page and give the submit to send the values to another page, which performs 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 the table is called "user" and the columns are "user_name", "user_user" and "user_password"):
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 like this:
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);
}
Notice the querys
that were added, how could I do this? I've already tried using tabs
and show with \t
but it did not work.