First Working Script Using Cake
akhire..
gini bos..
pertama buat database cakephp, lalu buat table products,

lalu insert beberapa data

Lalu pada folder cake\app\config\database.php edit
sesuai username dan password.
class DATABASE_CONFIG {
var $default = array(
’driver’ => ‘mysql’,
’persistent’ => false,
’host’ => ‘localhost’,
’login’ => ‘root’,
’password’ => ‘123123123′,
’database’ => ‘cakephp’,
’prefix’ => ”,
);
var $test = array(
’driver’ => ‘mysql’,
’persistent’ => false,
’host’ => ‘localhost’,
’login’ => ‘user’,
’password’ => ‘password’,
’database’ => ‘test_database_name’,
’prefix’ => ”,
);
}
cake/app/models/product.php
<?
class Product extends AppModel
{
var $name = “Product”;
}?>
cake/controllers/products_controller.php
<?
class ProductsController extends AppController
{
var $name = “Products”;
function index()
{
$Data = $this->Product->find(‘all’);
$this->set(‘Data’, $Data);
}
}?>
and finally
cake/app/views/products/index.ctp
<pre>
<?php print_r($Data);?>
</pre>
and the ouput should be like this

