Wednesday, April 27, 2011

Re: Truncate database table

Because, you are calling model's functions not dbo's functions
try this:

$this->ModelName->query("TRUNCATE TABLE `" . $this->ModelName->useTable . "`");


--
Lep pozdrav, Tilen Majerle



2011/4/27 Carachi <carachi83@gmail.com>
Hello,
I want truncate a table on mysql so I see that exist a function
truncate($table) on dbo_source.php
I try to use it so:

 $this->Model->truncate("Model");  // or  $this->Model->truncate();

 but it give error like:

SQL Error: 1064: You have an error in your SQL syntax; check the
manual ...

and the query is:

Query: truncate

without the table to truncate.
Why?
Where I wrong?

Thank you
Bye

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: