Yii

#1005 - Can't create table 'table_name' (errno: 150)

我与影子孤独终老i 提交于 2020-01-14 14:19:09
问题 here is my tables: DROP TABLE IF EXISTS `tbl_comments`; CREATE TABLE IF NOT EXISTS `tbl_comments` ( `id` int(11) NOT NULL auto_increment, `topic_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `text` text NOT NULL, `create_dt` datetime NOT NULL, `update_dt` timestamp NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `topic_id_2` (`topic_id`), KEY `user_id` (`user_id`), CONSTRAINT `tbl_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`), CONSTRAINT `tbl_comments_ibfk

Uploading file in Yii using ajax

最后都变了- 提交于 2020-01-14 12:47:11
问题 I am trying to implement file upload from a popover using ajax like facebook chat . I found that using ajax submit button, it is not able to upload files in Yii. So I tried to use like php method. Here is the php method I found, which is well working. <div id='preview'> </div> <form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'> Upload image: <div id='imageloadstatus' style='display:none'><img src="loader.gif" alt="Uploading...."/></div> <div id=

Print out a SQL single query (Yii 1.x)

半城伤御伤魂 提交于 2020-01-14 12:36:33
问题 I have a massive query that is generated using CDbCriteria as shown below:- $schema = Yii::app()->db->schema; $builder = $schema->commandBuilder; // how to echo out this query? $command = $builder->createFindCommand($schema->getTable('myuser'), $criteria); $results = $command->queryAll(); I know I can use the 'logging' feature of Yii to view the query, is it possible to just echo out this single query (as opposed to having Yii show me tons of other queries that are being run on the page). 回答1

Print out a SQL single query (Yii 1.x)

混江龙づ霸主 提交于 2020-01-14 12:36:11
问题 I have a massive query that is generated using CDbCriteria as shown below:- $schema = Yii::app()->db->schema; $builder = $schema->commandBuilder; // how to echo out this query? $command = $builder->createFindCommand($schema->getTable('myuser'), $criteria); $results = $command->queryAll(); I know I can use the 'logging' feature of Yii to view the query, is it possible to just echo out this single query (as opposed to having Yii show me tons of other queries that are being run on the page). 回答1

The requested URL /frontend/ru/site/login/ was not found on this server

做~自己de王妃 提交于 2020-01-14 06:18:47
问题 I have a problem, that my project working very nice on windows(on apache server ),then I moved my project to ubuntu 12.04 (apache2 server), but my project do not working. apache2 php 5.3.10 mysql 5.5.29-ubuntu0.12.04.2 on firebug: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /frontend/ru/site/login/ was not found on this server.</p> <hr> <address>Apache/2.2.22 (Ubuntu) Server at test.local

Yii2 and storing data in database as UTC

末鹿安然 提交于 2020-01-14 03:12:06
问题 I'm using Yii2 and I was wondering how it decides what timezone to store the data in the database as? I have noticed the $defaultTimezone which seems to indicate it simply controls what timezone your input data is supposed to be when passing it to functions such as the the asTime function and it uses the formatter timezone to convert said data into the correct time output. But I'm wondering how do you make sure it is inserting the data into your database in the right timezone so then the

Integration of SCORM with PHP/Yii [closed]

倖福魔咒の 提交于 2020-01-14 02:37:20
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago . Practically I am new to SCORM implementation in PHP. Theoretically I covered these areas before asking a question here - Already looked at Wiki SCORM that what does it means theoretically.(kinda standard to be followed for delivering content). Read about the moodle and SCORM(but may be I need to

Yii CUserIdentity vs a User Model

北慕城南 提交于 2020-01-13 19:55:13
问题 I have at least one model in my Yii project that will need to reference a particular user ID. In my SQL for the model I have something like CONSTRAINT FOREIGN KEY (user_id) REFERENCES User(id) . I was going to go ahead and create a User model when I came across the docs for CUserIdentity. I have to admit I am confused. Is a CUserIdentity a user or a state associated with a particular user-case? I would like to use as much of the built-in Yii features as possible since they handle a lot of

Yii CUserIdentity vs a User Model

南楼画角 提交于 2020-01-13 19:53:22
问题 I have at least one model in my Yii project that will need to reference a particular user ID. In my SQL for the model I have something like CONSTRAINT FOREIGN KEY (user_id) REFERENCES User(id) . I was going to go ahead and create a User model when I came across the docs for CUserIdentity. I have to admit I am confused. Is a CUserIdentity a user or a state associated with a particular user-case? I would like to use as much of the built-in Yii features as possible since they handle a lot of

condition while making relation in YIi

我只是一个虾纸丫 提交于 2020-01-13 13:50:20
问题 Agent: agent_id (primary key) User: f_id (foreign key) type I have created relation in this way public function relations() { return array( 'user' => array(self::HAS_ONE, 'Users', 'f_id'), ); } But I want to add more conditions like join only if type=3 in User table. thanks. 回答1: add the condition on your relation public function relations() { return array( 'user' => array(self::HAS_ONE, 'Users', 'f_id', array( 'condition' => 'user.type = :type', 'params' => array(':type'=>3) )), ); } http:/