-4
Good morning! I am with this code and I support the site, out of nowhere this error started to appear :(
public function getUrlcliente($cliente_id) {
$parametro = "cliente_id=" . (int)$cliente_id;
$url_cliente = $this->db->query("SELECT DISTINCT query as indice, keyword as url FROM url_cliente WHERE query = '" . $parametro . "'");
if (empty($url_cliente)) {
$url = "Erro - URL cliente não cadastrada";
}
else {
foreach ($url_cliente as $row) {
$url = $row->url;
}
if ($url_cliente->num_rows) {
return $url;
}
else
{
return "Erro-Url inexistente";
}
}
public function getcliente($cliente_id) { // Dá erro nesta linha ** Parse error: syntax error, unexpected 'public' (T_PUBLIC) in ....
$url_ex = $this->getUrlcliente($cliente_id);
$query = $this->db->query("SELECT DISTINCT *, p.name AS name, p.image, '" . $this->getUrlcliente($cliente_id) . "' AS url_externa FROM cliente p";
if ($query->num_rows) {
return array(
'cliente_id' => $query->row['cliente_id'],
'name' => $query->row['name'],
'image ' => $query->row['image'],
'url_externa' => $query->row['url_externa'],
'meta_description' => $query->row['meta_description'],
'meta_keyword' => $query->row['meta_keyword'],
'tag' => $query->row['tag']
);
} else {
return false;
}
}
}
I can’t find the reason for the mistake.
See if this helps you: http://stackoverflow.com/a/13341391/6101515
– JuniorNunes
@Juniornunes, it’s okay that he didn’t post the whole code, but if the error occurs in the second function, we can believe that everything is within a class, besides, it’s clear that it’s missing is to close the keys at some point...
– Kenny Rafael
@Kennyrafael truth!
– JuniorNunes
Simple typing error is out of scope, and you already have two answers explaining the error. It’s inattention when typing. Note that you were helped, it just doesn’t make sense to drop open the post because of this kind of error. There are two answers explaining the problem, and a comment just above. If you indent the code correctly it is evident that you have not closed one of the brackets.
– Bacco
I’m new to the forum, I didn’t understand how it worked. I’m sorry.
– MSergio
@Msergio does not need to apologize, everything is okay and you did nothing wrong, we are just explaining to you to understand the reason, and understand that it is nothing personal, only organization. We’re here to help. Don’t be discouraged to ask, the closure in this case was only a natural consequence, not a reproof. If you want to deal with it later, you have [help] with a number of issues that may help you locate, and also the Community FAQ on our 'meta" website, which is the site where the functioning of the main website is discussed.
– Bacco
@Bacco thank you so much. I am sending another question. rsrs Thank you.
– MSergio