CodeIgniter: usign db inside My_Lang - php

I found this useful Internationalization code:
http://pastebin.com/SyKmPYTX
everything works well except I am unable to connect to database.
what I need:
1) I need to check last segment
2) this is my db
DROP TABLE IF EXISTS `translate`;
DROP TABLE IF EXISTS `trans_data`;
DROP TABLE IF EXISTS `languages`;
/*Table structure for table `languages` */
CREATE TABLE `languages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`key` varchar(5) NOT NULL,
`default` tinyint(1) NOT NULL DEFAULT '0',
`display` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
/*Data for the table `languages` */
insert into `languages`(`name`,`key`,`default`,`display`) values
('GEO','ka',1,1),
('ENG','en',0,1),
('RUS','ru',0,1);
/*Table structure for table `trans_data` */
CREATE TABLE `trans_data` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
/*Table structure for table `translate` */
CREATE TABLE `translate` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lang` int(11) NOT NULL,
`data` int(11) NOT NULL,
`trans` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `lang_2` (`lang`,`data`),
KEY `lang` (`lang`),
KEY `data` (`data`),
CONSTRAINT `translate_ibfk_1` FOREIGN KEY (`lang`) REFERENCES `languages` (`id`),
CONSTRAINT `translate_ibfk_2` FOREIGN KEY (`data`) REFERENCES `trans_data` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=340 DEFAULT CHARSET=utf8;
in the first I need to do something like this
$this->db->where('key', end($this->segments));
$query = $this->db->get('languages');
$lang = $query->row();
if(empty($lang)){
$this->db->where('default', 1);
$query2 = $this->db->get('languages');
$lang = $query2->row();
}
$lang_array = [
"lang_key" => $lang->key,
"lang_id" => $lang->id
];
$this->session->set_userdata($lang_array);
if(end($this->uri->segment_array()) == $lang->key){
unset($this->uri->segments[intval($this->uri->total_segments() - 1)]);
}
after this functionality
then I need to download translates from database and save it in object with this query
SELECT TD.`name` , T.`trans`
FROM `translate` AS T
INNER JOIN `languages` AS L ON (T.`lang` = L.`id`)
INNER JOIN `trans_data` AS TD ON (T.`data` = TD.`id`)
WHERE (L.`key` = :lang_key);
and when I call from view
echo $this->lang->line('trans_key');
I need to get the value
but I do not undestand how to edit this class to do this job...
can you help me and edit this class for me?
thank you for future...

Related

Implicit MySQL Join on Update Statement - 0 rows affected

I'm trying to get this MySQL code to work, but it's saying 0 rows affected.
UPDATE assessments, assessment_types
SET assessments.assessment_type_id = assessment_types.id
WHERE (assessment_types.description = "Skills Assessment" AND assessments.id = 2);
Basically I have assessment_types with id and description column, and I just have the id in the assessments.assessment_type_id
I need to update the id.
I searched and couldn't find quite what I need for this.
Thanks!
Table Data:
assessment_types
id description
1 Knowledge Assessment
2 Skill Assessment
3 Personal Information
4 Natural Skills
Table Structure:
--
-- Table structure for table `assessments`
--
CREATE TABLE IF NOT EXISTS `assessments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_bin NOT NULL,
`acronym` varchar(255) COLLATE utf8_bin NOT NULL,
`assessment_type_id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` date NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `assessment_type_id` (`assessment_type_id`),
KEY `language_id` (`language_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2385 ;
--
-- Table structure for table `assessment_types`
--
CREATE TABLE IF NOT EXISTS `assessment_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(255) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ;
You can try doing an explicit join of the two tables in your UPDATE statement:
UPDATE assessments a
INNER JOIN assessment_types at
ON a.assessment_type_id = at.id
SET a.assessment_type_id = at.id
WHERE (at.description = "Skills Assessment" AND a.id = 2);

JOIN Query In MYSQL and PHP

I am going to generate specific information from all the tables in MYSQL. I have 5 tables in my database. I.e.:
advertiser
CREATE TABLE `advertiser` (
`Adv_id` int(11) NOT NULL AUTO_INCREMENT,
`Name` char(20) NOT NULL,
`F_Name` char(20) NOT NULL,
`Address` varchar(40) NOT NULL,
`CNIC` int(13) NOT NULL,
`Contact` int(11) NOT NULL,
`Monthly_fee` varchar(10) NOT NULL,
`Region` varchar(10) NOT NULL,
`Reg_date` varchar(10) NOT NULL,
PRIMARY KEY (`Adv_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
company_information
CREATE TABLE `company_information` (
`Company_id` int(11) NOT NULL AUTO_INCREMENT,
`Company_Name` varchar(20) NOT NULL,
`Company_Contact` int(11) NOT NULL,
`Company_Address` varchar(30) NOT NULL,
PRIMARY KEY (`Company_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
advertisement
CREATE TABLE `advertisement` (
`Ads_id` int(11) NOT NULL AUTO_INCREMENT,
`Adv_id_id` int(11) NOT NULL,
`Company_id` int(11) NOT NULL,
`Ads_Title` varchar(20) NOT NULL,
`Ads_Description` varchar(40) NOT NULL,
`Ads_Image` varchar(50) NOT NULL,
PRIMARY KEY (`Ads_id`),
KEY `Adv_id` (`Adv_id_id`),
KEY `Company_id` (`Company_id`),
CONSTRAINT `Adv_id` FOREIGN KEY (`Adv_id_id`) REFERENCES `advertiser` (`Adv_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `advertisement_ibfk_1` FOREIGN KEY (`Company_id`) REFERENCES `company_information` (`Company_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
ads_type
CREATE TABLE `ads_type` (
`Ads_type_id` int(11) NOT NULL AUTO_INCREMENT,
`Advertisement_id` int(11) NOT NULL,
`Full_Channel_Ads` varchar(30) NOT NULL,
`Logo_Ads` varchar(30) NOT NULL,
`Com_Break_Ads` varchar(30) NOT NULL,
PRIMARY KEY (`Ads_type_id`),
KEY `Advertisement_id` (`Advertisement_id`),
CONSTRAINT `Advertisement_id` FOREIGN KEY (`Advertisement_id`) REFERENCES `advertisement` (`Ads_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ads_date
CREATE TABLE `ads_date` (
`Ads_date_id` int(11) NOT NULL AUTO_INCREMENT,
`Ads_id` int(11) NOT NULL,
`Starting_Date` varchar(30) NOT NULL,
`Expiry_Date` varchar(30) NOT NULL,
PRIMARY KEY (`Ads_date_id`),
KEY `Ads_id` (`Ads_id`),
CONSTRAINT `Ads_id` FOREIGN KEY (`Ads_id`) REFERENCES `advertisement` (`Ads_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I want to retrive
Name, CNIN, and Contact from table Advertiser
Company_Name from company_information
Ads_Title from Advertisement
Starting_Date and Expiry_Date From ads_date.
This Query work well for the above rows :
SELECT *
FROM ads_date a
JOIN advertisement ci ON ci.Ads_id = a.Ads_id
JOIN company_information ar ON ar.Company_id = ci.Company_id
JOIN advertiser ad ON ad.Adv_id = ci.Advertiser_id
WHERE Expiry_Date >= CURDATE()
Problem:
I also want to retrive Advertisement_type from ads_type.
how can I do this with a JOIN query? Can any one explain?
You'll need another join:
SELECT *
FROM ads_date a
JOIN advertisement ci ON ci.Ads_id = a.Ads_id
JOIN company_information ar ON ar.Company_id = ci.Company_id
JOIN advertiser ad ON ad.Adv_id = ci.Advertiser_id
JOIN ads_type at ON at.Advertisement_id = ci.Ads_id -- Here
WHERE Expiry_Date >= CURDATE()
Please try the below query:
SELECT *
FROM ads_date a
JOIN advertisement ci ON ci.Ads_id = a.Ads_id
JOIN company_information ar ON ar.Company_id = ci.Company_id
JOIN advertiser ad ON ad.Adv_id = ci.Advertiser_id
JOIN ads_type at ON at.Advertisement_id =ci.Ads_id
WHERE Expiry_Date >= CURDATE()
Add another join as
JOIN ads_type at ON at.Advertisement_id = ci.Ads_id
Then use group_by at.Advertisement_id to avoid repetition.

Grocery Crud - CodeIgniter relation_n_n error

I have a problem while trying to save data (or update) in a crud with n_n relation, i have a product table, who is related to a product_detail, product detail has 3 foreign keys, to connect to a table called color, and other called material. Any idea why fail?, i appreciate your help, thanks.
The error is this:
A Database Error Occurred
Error Number: 1452
Cannot add or update a child row: a foreign key constraint fails (medina_db.product_detail, CONSTRAINT product_detail_ibfk_3 FOREIGN KEY (material_id) REFERENCES material (id))
INSERT INTO product_detail (product_id, color_id) VALUES ('4', '1')
Filename: /Applications/MAMP/htdocs/industrias_medina/models/grocery_crud_model.php
Line Number: 413
My Grocery Crud code:
$crud = new grocery_CRUD();
$crud->set_table('product')->set_subject('Productos');
$crud->set_relation_n_n("Colores", 'product_detail', 'color', 'product_id', 'color_id', 'name');
$crud->set_relation_n_n("Materiales", 'product_detail', 'material', 'product_id', 'material_id', 'name');
$crud->set_field_upload('image','assets/uploads/files');
$crud->fields('name','model','description', "Colores", "Materiales", 'image');
$output = $crud->render();
$this->_productos_output($output);
SQL:
CREATE TABLE `color` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2 AUTO_INCREMENT=2 ;
CREATE TABLE `material` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier',
`name` varchar(250) NOT NULL COMMENT 'Product''s name',
`model` varchar(250) NOT NULL COMMENT 'Product''s model',
`description` varchar(400) NOT NULL COMMENT 'Product''s description',
`image` varchar(400) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table to store products' AUTO_INCREMENT=13 ;
CREATE TABLE `product_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`color_id` int(11) NOT NULL,
`material_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`product_id`,`color_id`,`material_id`),
KEY `product_id` (`product_id`),
KEY `color_id` (`color_id`),
KEY `material_id` (`material_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
It looks like your product_detail table has a material_id column that references the material table. Your insert statement is not inserting anything into that material_id column. You need to either insert a value into that column (that exists in material), set a default value that references the key in material, or set a default of NULL for that column.
Thanks,
Andrew

Querying SQL multiple tables

I have a sql database with the following tables
Book Table
CREATE TABLE IF NOT EXISTS `books` (
`book_id` varchar(8) NOT NULL DEFAULT '',
`book_title` varchar(100) DEFAULT NULL,
`author1` varchar(20) NOT NULL,
`author2` varchar(20) DEFAULT NULL,
`publisher` varchar(20) NOT NULL,
`pub_year` year(4) NOT NULL,
`mod_id` varchar(8) NOT NULL,
`courseID` varchar(8) NOT NULL,
PRIMARY KEY (`book_id`),
KEY `id` (`book_id`),
KEY `book_id` (`book_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Courses Table
CREATE TABLE IF NOT EXISTS `courses` (
`courseID` varchar(8) NOT NULL,
`course_title` varchar(255) CHARACTER SET ascii NOT NULL,
`Entry_Year` int(1) NOT NULL,
`Duration` int(1) NOT NULL,
PRIMARY KEY (`courseID`),
KEY `courseID` (`courseID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Modules Table
CREATE TABLE IF NOT EXISTS `modules` (
`mod_id` varchar(8) NOT NULL,
`mod_title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
PRIMARY KEY (`mod_id`),
KEY `mod_title` (`mod_title`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Module Course Table
CREATE TABLE IF NOT EXISTS `mod_course` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`module` varchar(8) NOT NULL,
`course` varchar(8) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
I would like to query the database to show all book details of a course. A course has many modules and modules have many books. I have tried the following query but I think there is a problem with my tables as well. (FYI 'BIT' is the id of a course that is in the module course table)
SELECT b.book_id, b.book_title, b.author1, b.author2, b.publisher, b.pub_year, b.mod_id, mc.course
FROM books b
JOIN mod_course mc
WHERE mc.course = 'BIT'
I have had a deeper look at this and offer the following suggestion which includes changes to the data model also. This solution will also allow you to have the same book used for several modules (if required in the future). Also note the new table mod_books
The full code for this (including the query) is below... hope its ok
CREATE TABLE IF NOT EXISTS books
(book_id varchar(8) NOT NULL DEFAULT '',
book_title varchar(100) DEFAULT NULL,
author1 varchar(20) NOT NULL,
author2 varchar(20) DEFAULT NULL,
publisher varchar(20) NOT NULL,
pub_year year(4) NOT NULL,
PRIMARY KEY (book_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS courses
(course_ID varchar(8) NOT NULL,
course_title varchar(255) CHARACTER SET ascii NOT NULL,
Entry_Year int(1) NOT NULL,
Duration int(1) NOT NULL,
PRIMARY KEY (course_ID)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS modules
(mod_id varchar(8) NOT NULL,
mod_title varchar(255) NOT NULL,
description varchar(255) NOT NULL,
PRIMARY KEY (mod_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS mod_books
(mod_id varchar(8) NOT NULL,
book_id varchar(8) NOT NULL,
PRIMARY KEY (mod_id,book_id),
FOREIGN KEY (mod_id) REFERENCES modules (mod_id),
FOREIGN KEY (book_id) REFERENCES books (book_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS mod_course
(ID int(11) NOT NULL AUTO_INCREMENT,
mod_id varchar(8) NOT NULL,
course_ID varchar(8) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (mod_id) REFERENCES modules (mod_id),
FOREIGN KEY (course_ID) REFERENCES courses (course_ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
and the query would be
SELECT b.*
FROM mod_course mc
INNER JOIN mod_books mb
ON mb.mod_id = mc.mod_id
INNER JOIN books b
ON b.book_id = mb.book_id
WHERE mc.course_id = 'BIT'
based on the stated relationship course->module->books, you should drop the courseid column from the books table. the modid that you have is all you need.
the problem with your query is the missing join condition.
below the JOIN mod_course mc line you should add
ON mc.module = b.mod_id
After the keyword Join it should be ON not WHERE
SELECT B.*, MC.COURSE
FROM MODULECOURSE AS MC
INNER JOIN COURSES AS C
ON C.COURSE_TITLE = MC.COURSE
INNER JOIN BOOKS AS B
ON B.COURSEID= C.COURSEID

SQL error when generated SQL command with Doctrine PHP

I use Doctrine on my PHP web application with a MySQL database. I have a little problem with my request :
$q = Doctrine_Query::create()
->select('event.EventDate, event.EventId, player.PlayerId, player.FirstName,
player.LastName, player.Login, player.Email,
event_period.EventPeriodId, event.Type, event.Description,
period.StartHour, period.EndHour, player_event_period.Participate,
event_period.CourtNumber')
->from('Event event, Player player, Period period')
->leftJoin('player.PlayerEventPeriod player_event_period')
->leftJoin('player_event_period.EventPeriod event_period')
->where('period.PeriodId = event_period.PeriodId')
->andWhere('event.EventId = event_period.EventId');
if I show what is the generated MySQL command, I can see
SELECT e.eventid AS e__eventid, e.eventdate AS e__eventdate, e.type AS e__type, e.description AS e__description, p.playerid AS p__playerid, p.firstname AS p__firstname, p.lastname AS p__lastname, p.login AS p__login, p.email AS p__email, p2.periodid AS p2__periodid, p2.starthour AS p2__starthour, p2.endhour AS p2__endhour, p3.playereventperiodid AS p3__playereventperiodid, p3.participate AS p3__participate, e2.eventperiodid AS e2__eventperiodid, e2.courtnumber AS e2__courtnumber
FROM event e, player p, period p2
LEFT JOIN player_event_period p3 ON p.playerid = p3.playerid
LEFT JOIN event_period e2 ON p3.eventperiodid = e2.eventperiodid
WHERE (
p2.periodid = e2.periodid
AND e.eventid = e2.eventid
);
I get error :
#1054 - Unknown column 'p.playerid' in 'on clause'
What's wrong with my request ?
Thank you in advance
EDIT:
If that could help you. I have add the script that creates my database tables.
CREATE TABLE `event` (
`EventId` int(11) NOT NULL AUTO_INCREMENT,
`Type` varchar(100) NOT NULL,
`Description` text,
`EventDate` datetime NOT NULL,
`CreationDate` datetime NOT NULL,
`UpdateDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`EventId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `event_period` (
`EventPeriodId` int(11) NOT NULL AUTO_INCREMENT,
`PeriodId` int(11) NOT NULL,
`EventId` int(11) NOT NULL,
`CourtNumber` int(11) NOT NULL,
`CreationDate` datetime NOT NULL,
`UpdateDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`EventPeriodId`),
KEY `fk_event_period_to_period` (`PeriodId`),
KEY `fk_event_period_to_event` (`EventId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `period` (
`PeriodId` int(11) NOT NULL AUTO_INCREMENT,
`StartHour` time NOT NULL,
`EndHour` time NOT NULL,
`CreationDate` datetime NOT NULL,
`UpdateDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`PeriodId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `player` (
`PlayerId` int(11) NOT NULL AUTO_INCREMENT,
`Login` varchar(100) NOT NULL,
`Password` varchar(100) NOT NULL,
`RankId` int(11) NOT NULL DEFAULT '1',
`FirstName` varchar(100) NOT NULL,
`LastName` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
`ValidateId` varchar(100) NOT NULL,
`InscriptionDate` datetime NOT NULL,
`Enable` tinyint(1) NOT NULL,
`CreationDate` datetime NOT NULL,
`UpdateDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`PlayerId`),
KEY `fk_player_to_rank` (`RankId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `player_event_period` (
`PlayerEventPeriodId` int(11) NOT NULL AUTO_INCREMENT,
`PlayerId` int(11) NOT NULL,
`EventPeriodId` int(11) NOT NULL,
`Participate` tinyint(1) NOT NULL,
`CreationDate` datetime NOT NULL,
`UpdateDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`PlayerEventPeriodId`),
KEY `fk_player_event_period_to_player` (`PlayerId`),
KEY `fk_player_event_period_to_event_period` (`EventPeriodId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `event_period`
ADD CONSTRAINT `fk_event_period_to_period` FOREIGN KEY (`PeriodId`) REFERENCES `period` (`PeriodId`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_event_period_to_event` FOREIGN KEY (`EventId`) REFERENCES `event` (`EventId`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `player`
ADD CONSTRAINT `fk_player_to_rank` FOREIGN KEY (`RankId`) REFERENCES `rank` (`RankId`);
ALTER TABLE `player_event_period`
ADD CONSTRAINT `fk_player_event_period_to_player` FOREIGN KEY (`PlayerId`) REFERENCES `player` (`PlayerId`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_player_event_period_to_event_period` FOREIGN KEY (`EventPeriodId`) REFERENCES `event_period` (`EventPeriodId`) ON DELETE CASCADE ON UPDATE CASCADE;
Not sure how your models look but do your table called "player" have a column called "playerid" in it?
That's what mysql is complaining about.
[Edit]
I think that Doctrine prefers column names i lowercase.
(Can't remember if MySQL is case-sensitive regarding column names...)
Case sensitivity of MySQL column names depends on how the database/schema/tables are configured, but it looks like yours are case sensitive.
You haven't provided the entity definitions so I'm guessing at the issue, but try setting the name of the column.
For example for player id the annotation would be:
/**
* #Column(name="PlayerId", type="integer", length=11, nullable=false)
* #Id
* GeneratedValue(strategy="AUTO")
*/
protected $PlayerId;

Categories