Welcome Guest, Not a member yet? Register   Sign In
Requete with several like and where
#1

[eluser]Unknown[/eluser]
French :
Bonjour,
je souhaite réaliser une requête de recherche qui va rechercher un post en filtrant sur une catégorie sélection avant.
La recherche se fera sur le nom et le content.
Voici ce que je souhaite obtenir :
English :
Hello,
I want to make a search query that will search by filtering a post on a category selection before.
The research will be on name and content.
Here's what I want to:

Code:
SELECT *
FROM posts
WHERE posts.categoryid  =  '15'
AND  namepost  LIKE '%là%'
OR  posts.categoryid  =  '15'
AND content  LIKE '%là%'
J'ai essayer avec active record :
Code:
$this->db->where($conditions);
$this->db->like('namepost', $champsSerach);
$this->db->or_like('content', $champsSerach);
$this->db->where($conditions);
Mais j'obtiens :
Code:
SELECT *
FROM posts
WHERE posts.categoryid  =  '20'
AND posts.categoryid  =  '20'
AND  namepost  LIKE '%la%'
OR  content  LIKE '%la%'
A need your help please because i try lots things with where, or_where, etc.


Messages In This Thread
Requete with several like and where - by El Forum - 05-02-2012, 05:20 AM
Requete with several like and where - by El Forum - 05-02-2012, 07:38 AM
Requete with several like and where - by El Forum - 05-02-2012, 08:21 AM
Requete with several like and where - by El Forum - 05-02-2012, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB