EllisLab text mark
Advanced Search
     
Query runs OK outside of CI, but not in.
Posted: 04 August 2007 02:05 AM   [ Ignore ]
Joined: 2007-06-23
18 posts

This one has really got me scratching my head. I am sending a big long query into CI:

SELECT 
FROM item 
WHERE MATCH title
,short_desc,long_desc,participants,keywords,transcript 
AGAINST 
('+governance' IN BOOLEAN MODELIMIT 1000

as part of a search page, via $this->db->query().

It returns no valid rows, yet the same query run directly in mysql returns the expected row.

If I do this:

var_dumpmysql_result$result->result_id0'title')); 

to look at the mysyl result id, it also returns expected data.

Being new to CI I’m sure I’m missing something here, but I don’t know what…

(The reason I am not using a bunch of ->where() ->limit() statements is that I have a solid pre-existing class - set up as a library - that splits up the search terms and generates the query based on the tables field data).

 
Posted: 04 August 2007 03:31 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-10-02
332 posts

Try:

echo '<pre>';
print_r($query->result());
echo 
'</pre>'
 Signature 

Dotted line.

 
Posted: 04 August 2007 03:44 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-06-23
18 posts
Crimp - 04 August 2007 07:31 AM

Try:

echo '<pre>';
print_r($query->result());
echo 
'</pre>'

Thanks. That’s embarrassing. grin

I had pasted some older code in that had the return asigned to $result and forgot that it is a CI object that is returned.

Silly me, up too late last night guess.

 
Posted: 04 August 2007 05:04 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2006-10-02
332 posts

And why do you think I had that snippet stored in my clippings? wink

 Signature 

Dotted line.

 
Posted: 04 August 2007 10:20 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-23
3194 posts

Yeah, how many times have I typed that.  Or my other favourite

echo $this->db->last_query(); 
 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design

 
Posted: 04 August 2007 08:09 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2007-06-23
18 posts
Derek Allard - 04 August 2007 02:20 PM

Yeah, how many times have I typed that.  Or my other favourite

echo $this->db->last_query(); 

I really don’t feel so bad about it now… grin

R

 
Posted: 04 August 2007 08:43 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2006-07-10
485 posts

Gee whiz…

http://www.google.com/search?hl=en&rls=com.microsoft:en-us&defl=en&q=define:Deja+vu&sa=X&oi=glossary_definition&ct=title