-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

$this->db->query duas vezes? O.o

function check_url_exists_in_db($url) {

  $this -> db -> query("SELECT * FROM nws_news WHERE
url={$this->db->escape($url)} AND active=1 ");

  if ($this->db->affected_rows() >= 1) {
    return true;
  }
  else {            
    return false;     
  }

}


Andrey Wischneski wrote:
> O $this->db->escape($url) já coloca os ' ' para você...
>
> O Certo fica assim:
>
> function check_url_exists_in_db($url)
> {
>   $query = $this->db->query("SELECT * FROM nws_news WHERE
> url=".$this->db->escape($url)." AND active='1'");
>   $this->db->query($query);
>   if ($this->db->affected_rows() >= 1)
>   {
>     return true;
>   }
>   else
>   {           
>     return false;    
>   }
> }
>
>
> Andrey
>
>
> 2008/11/4 Cleyverson Costa <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
>
>     Pesoal, o que existe de errado nesta função??
>
>         function check_url_exists_in_db($url) {
>             $query = $this->db->query("SELECT * FROM nws_news WHERE
>     url='".$this->db->escape($url)."' AND active='1'");
>             $this->db->query($query);
>             if ($this->db->affected_rows() >= 1) {
>                 return true;
>             }
>             else {            
>                 return false;     
>             }
>         }
>
>     --
>
>
>       A Database Error Occurred
>
>     Error Number: 1064
>
>     You have an error in your SQL syntax; check the manual that
>     corresponds to your MySQL server version for the right syntax to
>     use near
>     'http://noticias.uol.com.br/ultnot/efe/2008/08/26/ult1808u125085.jhtm''
>     AND activ' at line 1
>
>     SELECT * FROM nws_news WHERE
>    
url=''http://noticias.uol.com.br/ultnot/efe/2008/08/26/ult1808u125085.jhtm''
>     AND active='1'
>
>
>
>     _______________________________________________
>     Lista mailing list
>     [email protected] <mailto:[email protected]>
>     http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>
>
>
> ----------------------------------------------------------------------
>
> _______________________________________________
> Lista mailing list
> [email protected]
> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br

- --
Att,

'É um orgulho ter você como nosso cliente'
____________________________
Eric Silva
Desenvolvedor

ArgoHost.net
Hospedagem Web com Facilidade
http://www.argohost.net

Suporte Telefônico:
Fortaleza  - (85) 3198-3030
São Paulo - (11) 4063-4844
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJEC3U+/gtfgY0bXURAiYWAJwL5CHV0LzKbPlxdFlm+C2XgSNYkgCgmz61
MgbT6HiyRH+xDeo5weNZGoY=
=h8q4
-----END PGP SIGNATURE-----

_______________________________________________
Lista mailing list
[email protected]
http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br

Responder a