Hello, I'm quite new to CakePHP but there is something very simple I
want to do, and I can't get it right.
I'm building a website that shows trips people can book.
The trip index page is /packages/index
I want to log every time someone clicks on a trip in a table called
Packagesclicks.
So I have to save a new Packagesclick model in the view action of the
Packages (trips) controller.
Somehow, I can not get it working.
Here is my code:
[code]
class PackagesController extends AppController
{
var $name = "Packages";
var $uses = array('Package', 'Packagesclick');
function view($id = null)
{
$data = null;
$data['Packagesclick']['packagesID'] = $id;
$data['Packagesclick']['clickdate'] = date("Y-m-d H:i:s");
$data['Packagesclick']['usersID'] =
$this->Session->read("usersID");
$this->Packagesclick->save($data);
$this->Package->id = $id;
$this->set("package", $this->Package->read());
}
/* index actions are below here, I snipped them */
}
[/code]
It is not saving a new record to the database.
What would be the right way to accomplish such?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---