I am creating a news system where the user has the option to register the news and put the original link where the news was generated, so far so good, the problem is that I want the user to have the option to register the news with the news link that will be generated, I'm doing it this way:
$urlNoticia = "index.php?".PARAMETER_NAME_ACTION."=show&";
$urlNoticia .= PARAMETER_NAME_FILE."=exibir_noticia";
$urlNoticia .= "¬icia_id=".$model->getnoticia_id();
if(isset($_POST['FLinkNoticia'])) {
$error = $this->getConexao()->executeNonQuery($sql);
$sqll = "UPDATE noticia SET not_link = '".URL.$urlNoticia."SELECT MAX(noticia_id) FROM noticia' ";
$sqll .= "WHERE not_titulo = '".$model->getnot_titulo()."'";
$error = $this->getConexao()->executeNonQuery($sqll);
} else {
$error = $this->getConexao()->executeNonQuery($sql);
}
FLinkNoticia is a checkbox.
At first $error
it inserts into the database, and right after it should UPDATE
, it until it performs UPDATE
but does not have the news ID, just the URL