Result of $this->Model->query($string) ON ERROR
Hi everyone,
This seems like a simple enough thing but I can't find any documentation on it. When you run a custom query using $this->Model->query($string) it must return one of three things:
1. It finds some rows and returns an array with some information in it.
2. It finds no rows and returns an empty array.
But what happens when 3. the query fails?
Does it return false?
Need to know this for error checking.
Thanks for the help!
Asked by cshinnimin, on 3/4/10
1 Answer
just run $this->Model->query('some crap sql'); and you will soon know
Answered by dogmatic69on 3/4/10
That's not a Cake error you're seeing, it's a SQL error. Try running an invalid query with regular PHP - you'll get the same error. mysql_query() returns false for an invalid query, so I suspect that the Model::query() function returns the same.
jnay - on 3/4/10
Your Answer
You can use Creole Wiki Syntax to format your text.
Rating
0
Viewed
256 times
Last Activity
on 3/4/10