Welcome Guest, Not a member yet? Register   Sign In
Query runs OK outside of CI, but not in.
#1

[eluser]richard_ctv[/eluser]
This one has really got me scratching my head. I am sending a big long query into CI:
Code:
SELECT *
FROM item
WHERE MATCH title,short_desc,long_desc,participants,keywords,transcript
AGAINST ('+governance' IN BOOLEAN MODE) LIMIT 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:
Code:
var_dump( mysql_result( $result->result_id, 0, '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).
#2

[eluser]Crimp[/eluser]
Try:

Code:
echo '<pre>';
print_r($query->result());
echo '</pre>';
#3

[eluser]richard_ctv[/eluser]
[quote author="Crimp" date="1186227065"]Try:

Code:
echo '<pre>';
print_r($query->result());
echo '</pre>';
[/quote]

Thanks. That's embarrassing. :-)

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.
#4

[eluser]Crimp[/eluser]
And why do you think I had that snippet stored in my clippings? ;-)
#5

[eluser]Derek Allard[/eluser]
Yeah, how many times have I typed that. Or my other favourite
Code:
echo $this->db->last_query();
#6

[eluser]richard_ctv[/eluser]
[quote author="Derek Allard" date="1186251630"]Yeah, how many times have I typed that. Or my other favourite
Code:
echo $this->db->last_query();
[/quote]
I really don't feel so bad about it now... :-)

R
#7

[eluser]esra[/eluser]
Gee whiz...

http://www.google.com/search?hl=en&rls=c...n&ct=title




Theme © iAndrew 2016 - Forum software by © MyBB