kohana-3

Kohana 3.1 ORM: How to make 'where … in' clause

非 Y 不嫁゛ 提交于 2020-02-14 01:13:43
问题 Thanks to Kohana's excellent documentation, I'm having to resort to prostrate myself on SO. ;) Hopefully this is really simple: I'm trying to gather all stories which belong to a certain group of IDs. My code is as follows: $story_ids = '(12,56,99,213,319)'; $stories = ORM::factory('story')->where('id', 'IN', $story_ids)->find_all(); However, this is obviously not working. I'm getting a MySQL error because single-quotes are being put around the $story_ids string in the query. EDIT: I've also

Kohana 3.1 ORM: How to make 'where … in' clause

时光总嘲笑我的痴心妄想 提交于 2020-02-14 01:11:48
问题 Thanks to Kohana's excellent documentation, I'm having to resort to prostrate myself on SO. ;) Hopefully this is really simple: I'm trying to gather all stories which belong to a certain group of IDs. My code is as follows: $story_ids = '(12,56,99,213,319)'; $stories = ORM::factory('story')->where('id', 'IN', $story_ids)->find_all(); However, this is obviously not working. I'm getting a MySQL error because single-quotes are being put around the $story_ids string in the query. EDIT: I've also

Is there a way to override Model properties without defining them all again with Kohana?

北城以北 提交于 2020-02-05 10:58:50
问题 I have the following, for example: class Model_User extends ORM { protected $_rules = array( 'username' => array( 'not_empty' => NULL, 'min_length' => array(6), 'max_length' => array(250), 'regex' => array('/^[-\pL\pN_@.]++$/uD'), ), 'password' => array( 'not_empty' => NULL, 'min_length' => array(5), 'max_length' => array(30), ), 'password_confirm' => array( 'matches' => array('password'), ), ); } class Model_UserAdmin extends Model_User { protected $_rules = array( 'username' => array( 'not

Is there a way to override Model properties without defining them all again with Kohana?

时间秒杀一切 提交于 2020-02-05 10:58:41
问题 I have the following, for example: class Model_User extends ORM { protected $_rules = array( 'username' => array( 'not_empty' => NULL, 'min_length' => array(6), 'max_length' => array(250), 'regex' => array('/^[-\pL\pN_@.]++$/uD'), ), 'password' => array( 'not_empty' => NULL, 'min_length' => array(5), 'max_length' => array(30), ), 'password_confirm' => array( 'matches' => array('password'), ), ); } class Model_UserAdmin extends Model_User { protected $_rules = array( 'username' => array( 'not

Error message while logging in in Kohana

☆樱花仙子☆ 提交于 2020-01-14 18:59:08
问题 I'm using Kohana 3 and I have an issue while logging in with an user. I use this line to log in: $success = Auth::instance()->login($_POST['login_user'], $_POST['login_password'], $remember); And I got this error message: Session_Exception [ 1 ]: Error reading session data. ~ SYSPATH/classes/kohana/session.php [ 326 ] I have the sessions table created with the follow SQL: CREATE TABLE `sessions` ( `session_id` varchar(24) NOT NULL, `last_active` int(10) unsigned DEFAULT NULL, `contents` text,

Kohana 3 Command line output buffering?

房东的猫 提交于 2020-01-14 09:52:28
问题 I am using Kohana 3 and I have a controller that extends Kohana_Controller. I call it from the command line using: php /path/to//index.php --uri="url/path" It works just fine, but this particular script takes a long time and during the execution I am echoing status messages (echo 'status message';) but none of the messages appear until after the script has completed executing. I want to see the status messages as they are echoed, can anyone tell me how to do it? Thanks 回答1: It looks like

Kohana ORM - Incorrect table name

一笑奈何 提交于 2020-01-06 08:23:08
问题 I have a weird problem with the Kohana (3.2) ORM query builder and i can't figure out what is wrong. I get "Incorrect table name" exception: Database_Exception [ 1103 ]: Incorrect table name '' [ SELECT ``.* FROM `` JOIN `user_plugins` ON (`user_plugins`.`plugin_id` = ``.`id`) WHERE `user_plugins`.`user_id` = '9' ] As you can see the table is empty in the query. Controller: $user = ORM::factory('user', Auth::instance()->get_user()->id); if ($user->loaded() ) { $result = $user->plugin->find

Kohana ORM - Incorrect table name

穿精又带淫゛_ 提交于 2020-01-06 08:23:05
问题 I have a weird problem with the Kohana (3.2) ORM query builder and i can't figure out what is wrong. I get "Incorrect table name" exception: Database_Exception [ 1103 ]: Incorrect table name '' [ SELECT ``.* FROM `` JOIN `user_plugins` ON (`user_plugins`.`plugin_id` = ``.`id`) WHERE `user_plugins`.`user_id` = '9' ] As you can see the table is empty in the query. Controller: $user = ORM::factory('user', Auth::instance()->get_user()->id); if ($user->loaded() ) { $result = $user->plugin->find

Kohana 3.1.4: Database_Exception [ 2 ]: mysql_connect(): Access denied

孤人 提交于 2020-01-05 09:14:19
问题 I´m trying to walk through a tutorial for kohana I have copied the scripts but I getting the following error message: ERROR: Database_Exception [ 2 ]: mysql_connect(): Access denied for user 'www-data'@'localhost' (using password: NO) ~ MODPATH/database/classes/kohana/database/mysql.php [ 67 ] Could anyone give me some hints to where the problem might lie? I have other projects which use mysql so I know that the password and username are correct. 回答1: If you change the username in your config

TCPDF HTML with Special Characters displays empty PDF file

二次信任 提交于 2019-12-28 13:34:30
问题 I am using TCPDF Library Version: 5.9.011. I am trying to execute HTML layout as PDF. For which I tried with example provide with the site $html = '<h1>HTML Example</h1> <h2>List</h2> Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash '; // output the HTML content $pdf->writeHTML($html, true, false, true, false, ''); //Close and output PDF document $pdf->Output('example_006.pdf', 'I'); Apparently found that generated PDF only default header and footer with