Database Error
Error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'total' cannot be null
SQL Query:
INSERT INTO `tokoan39_web2`.`carts` (`total`, `category_product`, `product_id`, `quantity`, `price`, `product_code`, `product_image`, `product_name`, `session_id`) VALUES (NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, 'c88c3f4cc0799eb67aacde431b6f0e06')
Notice:
If you want to customize this error message, create app/View/Errors/pdo_error.ctp
Stack Trace
- CORE/Cake/Model/Datasource/DboSource.php line 460 → PDOStatement->execute(array)
try {
$query = $this->_connection->prepare($sql, $prepareOptions);
$query->setFetchMode(PDO::FETCH_LAZY);
if (!$query->execute($params)) {
$this->_results = $query;
- CORE/Cake/Model/Datasource/DboSource.php line 426 → DboSource->_execute(string, array)
$options += array('log' => $this->fullDebug);
$t = microtime(true);
$this->_result = $this->_execute($sql, $params);
'INSERT INTO `tokoan39_web2`.`carts` (`total`, `category_product`, `product_id`, `quantity`, `price`, `product_code`, `product_image`, `product_name`, `session_id`) VALUES (NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, 'c88c3f4cc0799eb67aacde431b6f0e06')'
array()
- CORE/Cake/Model/Datasource/DboSource.php line 1004 → DboSource->execute(string)
'values' => implode(', ', $valueInsert)
);
if ($this->execute($this->renderStatement('create', $query))) {
if (empty($id)) {
'INSERT INTO `tokoan39_web2`.`carts` (`total`, `category_product`, `product_id`, `quantity`, `price`, `product_code`, `product_image`, `product_name`, `session_id`) VALUES (NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, 'c88c3f4cc0799eb67aacde431b6f0e06')'
- CORE/Cake/Model/Model.php line 1761 → DboSource->create(AppModel, array, array)
}
}
if (!$db->create($this, $fields, $values)) {
$success = false;
object(AppModel) {
useDbConfig => 'default'
useTable => 'carts'
id => false
data => array(
[maximum depth reached]
)
schemaName => 'tokoan39_web2'
table => 'carts'
primaryKey => 'id'
validate => array([maximum depth reached])
validationErrors => array([maximum depth reached])
validationDomain => null
tablePrefix => ''
plugin => null
name => 'Cart'
alias => 'Cart'
tableToModel => array(
[maximum depth reached]
)
cacheQueries => false
belongsTo => array([maximum depth reached])
hasOne => array([maximum depth reached])
hasMany => array([maximum depth reached])
hasAndBelongsToMany => array([maximum depth reached])
actsAs => null
Behaviors => object(BehaviorCollection) {}
whitelist => array([maximum depth reached])
cacheSources => true
findQueryType => null
recursive => (int) 1
order => null
virtualFields => array([maximum depth reached])
__backAssociation => array([maximum depth reached])
__backInnerAssociation => array([maximum depth reached])
__backOriginalAssociation => array([maximum depth reached])
__backContainableAssociation => array([maximum depth reached])
findMethods => array(
[maximum depth reached]
)
[protected] _schema => array(
[maximum depth reached]
)
[protected] _associationKeys => array(
[maximum depth reached]
)
[protected] _associations => array(
[maximum depth reached]
)
[protected] _insertID => null
[protected] _sourceConfigured => true
[protected] _eventManager => object(CakeEventManager) {}
[protected] _validator => object(ModelValidator) {}
}
array(
(int) 0 => 'total',
(int) 1 => 'category_product',
(int) 2 => 'product_id',
(int) 3 => 'quantity',
(int) 4 => 'price',
(int) 5 => 'product_code',
(int) 6 => 'product_image',
(int) 7 => 'product_name',
(int) 8 => 'session_id'
)
array(
(int) 0 => null,
(int) 1 => (int) 0,
(int) 2 => null,
(int) 3 => (int) 1,
(int) 4 => null,
(int) 5 => null,
(int) 6 => null,
(int) 7 => null,
(int) 8 => 'c88c3f4cc0799eb67aacde431b6f0e06'
)
- APP/Controller/CartController.php line 36 → Model->save(array)
'total'=>$data['harga_sekarang'],
'session_id'=>$this->Session->read('Config.userAgent')
)
);
//$count= $this->Cart->find('count',array('conditions'=>array('session_id'=>$this->Session->read('Config.userAgent'))));
array(
'category_product' => (int) 0,
'product_id' => null,
'quantity' => (int) 1,
'price' => null,
'product_code' => null,
'product_image' => null,
'product_name' => null,
'total' => null,
'session_id' => 'c88c3f4cc0799eb67aacde431b6f0e06'
)
- [internal function] → CartController->add(string)
- CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(CartController, array)
'action' => $request->params['action']
));
}
return $method->invokeArgs($this, $request->params['pass']);
object(CartController) {
uses => array(
[maximum depth reached]
)
name => 'Cart'
helpers => array([maximum depth reached])
request => object(CakeRequest) {}
response => object(CakeResponse) {}
viewPath => 'Cart'
layoutPath => null
viewVars => array(
[maximum depth reached]
)
view => 'add'
layout => 'default'
autoRender => true
autoLayout => true
Components => object(ComponentCollection) {}
components => array(
[maximum depth reached]
)
viewClass => 'View'
View => null
ext => '.ctp'
plugin => null
cacheAction => false
passedArgs => array(
[maximum depth reached]
)
scaffold => false
methods => array(
[maximum depth reached]
)
modelClass => 'Product'
modelKey => 'cart'
validationErrors => null
Session => object(SessionComponent) {}
theme => 'Metro'
Brand => object(AppModel) {}
Cart => object(AppModel) {}
Configuration => object(AppModel) {}
CategoryType => object(AppModel) {}
Category => object(Category) {}
Product => object(Product) {}
[protected] _responseClass => 'CakeResponse'
[protected] _mergeParent => 'AppController'
[protected] _eventManager => object(CakeEventManager) {}
}
array(
(int) 0 => '4616'
)
- CORE/Cake/Routing/Dispatcher.php line 187 → Controller->invokeAction(CakeRequest)
$controller->startupProcess();
$render = true;
$result = $controller->invokeAction($request);
if ($result instanceof CakeResponse) {
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'cart/add/4616'
base => ''
webroot => '/'
here => '/cart/add/4616'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
- CORE/Cake/Routing/Dispatcher.php line 162 → Dispatcher->_invoke(CartController, CakeRequest, CakeResponse)
));
}
$response = $this->_invoke($controller, $request, $response);
if (isset($request->params['return'])) {
object(CartController) {
uses => array(
[maximum depth reached]
)
name => 'Cart'
helpers => array([maximum depth reached])
request => object(CakeRequest) {}
response => object(CakeResponse) {}
viewPath => 'Cart'
layoutPath => null
viewVars => array(
[maximum depth reached]
)
view => 'add'
layout => 'default'
autoRender => true
autoLayout => true
Components => object(ComponentCollection) {}
components => array(
[maximum depth reached]
)
viewClass => 'View'
View => null
ext => '.ctp'
plugin => null
cacheAction => false
passedArgs => array(
[maximum depth reached]
)
scaffold => false
methods => array(
[maximum depth reached]
)
modelClass => 'Product'
modelKey => 'cart'
validationErrors => null
Session => object(SessionComponent) {}
theme => 'Metro'
Brand => object(AppModel) {}
Cart => object(AppModel) {}
Configuration => object(AppModel) {}
CategoryType => object(AppModel) {}
Category => object(Category) {}
Product => object(Product) {}
[protected] _responseClass => 'CakeResponse'
[protected] _mergeParent => 'AppController'
[protected] _eventManager => object(CakeEventManager) {}
}
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'cart/add/4616'
base => ''
webroot => '/'
here => '/cart/add/4616'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
object(CakeResponse) {
[protected] _statusCodes => array(
[maximum depth reached]
)
[protected] _mimeTypes => array(
[maximum depth reached]
)
[protected] _protocol => 'HTTP/1.1'
[protected] _status => (int) 200
[protected] _contentType => 'text/html'
[protected] _headers => array([maximum depth reached])
[protected] _body => null
[protected] _file => null
[protected] _fileRange => null
[protected] _charset => 'UTF-8'
[protected] _cacheDirectives => array([maximum depth reached])
[protected] _cookies => array([maximum depth reached])
}
- APP/webroot/index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse)
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'cart/add/4616'
base => ''
webroot => '/'
here => '/cart/add/4616'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
object(CakeResponse) {
[protected] _statusCodes => array(
[maximum depth reached]
)
[protected] _mimeTypes => array(
[maximum depth reached]
)
[protected] _protocol => 'HTTP/1.1'
[protected] _status => (int) 200
[protected] _contentType => 'text/html'
[protected] _headers => array([maximum depth reached])
[protected] _body => null
[protected] _file => null
[protected] _fileRange => null
[protected] _charset => 'UTF-8'
[protected] _cacheDirectives => array([maximum depth reached])
[protected] _cookies => array([maximum depth reached])
}