Welcome Guest, Not a member yet? Register   Sign In
the sql queries are echoed out 'how to stop it?
#1

[eluser]shait[/eluser]
how can i avoid the queries echoed out? why it happens?
#2

[eluser]InsiteFX[/eluser]
Kind of hard to tell without seeing the code.

We are not mind readers and have crystal balls.

And please use code tags when posting the code.
#3

[eluser]shait[/eluser]
this is what i return to the controller
Code:
return $this->db->get('contactform');
in the html i can see the query
SELECT * FROM contactform

the debug mode is on false

that's all
thanks
#4

[eluser]astroanu[/eluser]
of course it should return a mysql query. read the CI doc again on how to use the db class.

Code:
$query = $this->db->get('contactform');

foreach ($query->result() as $row)
{
    echo $row->title;
}

or return the result as an array
Code:
$query = $this->db->get('contactform');
return $query->result()
#5

[eluser]john_j[/eluser]
is there an echo inside your contact form?
#6

[eluser]PhilTem[/eluser]
@astronau: That's wrong. It actually returns a resource handle that is related to the result of a MySQL-query. If you do a

Code:
$query = $this->db->get('contactform');
var_dump($query);

you will get a resource handle type (refer to the "Return Values"-section on mysql-query help. That said, it isn't a query and you cannot really echo it as well. The only thing you can echo is

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

which holds the last query-string.

Anyways, usually no queries are echoed/printed on your screen unless you echo/print them. Even the debug mode set to TRUE will not echo the queries.
#7

[eluser]NeoArc[/eluser]
Make sure you don't have the ci debugger enabled:

$this->output->enable_profiler();
#8

[eluser]shait[/eluser]
thanks all for the answers, i followed your advise but the query is still echoing out.
I think it is strange and i cant find the reason
if you have more ideas that will be great
#9

[eluser]CroNiX[/eluser]
Well, you need to go through all of your code to see where you are echoing it out. We can't do that for you.

Go through the controller, any model being used in that controller, the views, helpers, anything that is being used to generate that page.




Theme © iAndrew 2016 - Forum software by © MyBB