CodeIgniter Forums
Query runs OK outside of CI, but not in. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Query runs OK outside of CI, but not in. (/showthread.php?tid=2420)



Query runs OK outside of CI, but not in. - El Forum - 08-03-2007

[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).


Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

[eluser]Crimp[/eluser]
Try:

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



Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

[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.


Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

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


Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

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



Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

[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


Query runs OK outside of CI, but not in. - El Forum - 08-04-2007

[eluser]esra[/eluser]
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