hi guys, i am programmer in php, now i am learning cakephp and also am new
to the framework.
i already worked out some examples. here
I have some doubts in cakephp, kindly see below and tell me where I am going
wrong?
-----------------------------------
1.In Scaffolding delete option is not working with the cake PHP,When we run
the following program by
http://localhost/cake/app/vendors/
=>it showing the details from the tables with all fields and also
view,Edit,delete links and New vendor option
=>Except Delete link,all the links are working.
=>When we clicked the delete link it showing the following error
====
Error
=====
"Query: DELETE `Vendor` FROM `Vendors` AS `Vendor` WHERE `Vendor`.`id`
IN (1)
Warning (512): SQL Error: 1066: Not unique table/alias: 'vendor'
[CORE\cake\libs\model\datasources\dbo_source.php, line 440]
Code | Context
$sql = "DELETE `Vendor` FROM `Vendors` AS `Vendor` WHERE
`Vendor`.`id` IN (1) "
$error = "1066: Not unique table/alias: 'vendor'"
e("<p style = \"text-align:left\"><b>Query:</b> {$sql} ");
if ($error) {
trigger_error("<span style =
\"color:Red;text-align:left\"><b>SQL Error:</b> {$this->error}</span>",
E_USER_WARNING);
DboSource::showQuery() - CORE\cake\libs\model\datasources\dbo_source.php,
line 440
DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php, line
166
DboSource::delete() - CORE\cake\libs\model\datasources\dbo_source.php, line
1345
Model::del() - CORE\cake\libs\model\model.php, line 1466
Scaffold::__scaffoldDelete() - CORE\cake\libs\controller\scaffold.php, line
344
Scaffold::__scaffold() - CORE\cake\libs\controller\scaffold.php, line 422
Scaffold::__construct() - CORE\cake\libs\controller\scaffold.php, line 193
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 256
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 240
[main] - APP\webroot\index.php, line 84
There was an error deleting the Vendor with id: 1"
=======
Coding
========
vendors_controller.php(controller)
======================
<?php
class VendorsController extends AppController {
var $name = 'vendors';
var $scaffold;
}
?>
vendor.thtml(Views)
===================
<form action="vendor" method="post">
<p>Please fill out the form below to register an account.</p>
<label>Username:</label><input name="username" size="40" />
<label>Passwors:</label><input name="password" size="40" />
<label>First Name:</label><input name="f_name" size="40" />
<label>Last Name:</label><input name="l_name" size="40" />
<input type="submit" value="register" />
</form>
vendor.php(Models)
==========
<?php
class Vendor extends AppModel
{
var $name = 'Vendor';
var $useTable = 'Vendors';
var $validate = array(
'username' => VALID_NOT_EMPTY,
'password' => VALID_NOT_EMPTY,
'f_name' => VALID_NOT_EMPTY,
'l_name' => VALID_NOT_EMPTY
);
}
?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---