kohana

How to call procedure in kohana 3.1

左心房为你撑大大i 提交于 2019-12-08 09:41:46
问题 Kohana is a php framework. this is the documention . how to call procedure in this framework. i have searched and questions about this question. like : insert_id in Kohana 3 this is my code : $conn = Database::instance(); $queryStr = "call sp_createUser('$nick_name','$email','$password','127.0.0.1')"; $query = DB::query(Database::SELECT, $queryStr); $query->execute($conn); but there's some exception.. Database_Exception [ 1312 ]: PROCEDURE sp_createUser can't return a result set in the given

Set global variables for all controllers in Kohana 2.3.4

不问归期 提交于 2019-12-08 09:07:32
问题 Is the proper way to make a few variables available to all my controllers to add a MY_Controller.php file in my /application/libraries/ folder (shown in the docs here)? I'm working in Kohana 2.3.4 and wondering if there are any better ways to do it, or is this the only recommended method? Being new to OOP, can you link me to any examples? I've heard the right answer is to add the vars to your $config[] , trying to get more details. 回答1: The proper way is to make a custom config file

When using Kohana DB, how does one avoid duplicate code when needing a count for pagination?

南楼画角 提交于 2019-12-08 08:30:49
问题 Using the Kohana query builder, is it possible to build my query piece by piece. Then execute a count on said query. Then execute the query itself. All without having to write duplicate conditionals... one for the count and one for the results... Adding DB::select(array('COUNT("pid")', 'mycount')) To the main query results in only getting back one record. Is it maybe possible to execute the count, and somehow remove array('COUNT("pid")', 'mycount') from the select... Right now the only way I

Kohana 2.3.4 ORM pivot table query

元气小坏坏 提交于 2019-12-08 08:26:51
问题 I'm trying to query a pivot table with Kohana's ORM and I'm wondering if there is a built in function I'm missing. Currently I only have 2 models setup for the tables "categories" and "products". There is a pivot table "categories_products", but I don't need a model for it when inserting data with this: $product = ORM::factory('product'); $product->add(ORM::factory('category', $addCat)); However, I can't figure out how to query it without creating a model for it. The "join_table" function

SabreDAV + Nginx + PUT (creates 0 byte file)

可紊 提交于 2019-12-08 07:32:46
问题 I'm trying to get SabreDAV and Nginx to work but it is creating a ZERO byte file (using Cyberduck as my DAV client). The file gets created but no content (so basically like a touch) The HTML frontend plugin uploads fine so I think the file permissions are OK. I can't seem to figure out how to get debug info out of SabreDAV (without hacking the code) I've tried enabling the http_dav_module (not really sure if this is relevant) sudo nginx -V configure arguments: --prefix=/usr/share/nginx --conf

how to extend kohana user auth module

谁都会走 提交于 2019-12-08 04:36:09
问题 So i'm using kohana user module, and i would like to extend my register page, now it adds username, email, and password but i would like to add some extra fields, and i just can't find where can i do it. I found function action_register which leads to Auth::instance()->register($_POST, true); so i found this function register($fields) which leads to $user = ORM::factory('user'); and $user->create_user($fields, array() so i'm stuck somewhere here, i'm not even sure if i'm going the right path.

In Kohana 3, how do you figure out errors made during a query?

旧巷老猫 提交于 2019-12-08 04:18:46
问题 I'm using Kohana 3. I'm writing an update query, and it is working for everything except this one section. If I do a var_dump() on the results of $db->execute() I get either a 1 or 0 to say it failed or not. It is failing in this example (returning 0). How can I figure out what error is happening? It justs seems to be silenty failing at the time being. I tried doing echo mysql_error() but it didn't work, as I expected, as Kohana 3's db library uses PDO I'm pretty sure. How can I figure out

Class not found exception - Making a Helper on Kohana 3.1

强颜欢笑 提交于 2019-12-07 16:29:13
问题 got a fresh install of Kohana 3.1. Trying to make my own helpers. I have created a helper in the application/classes/helpers/ directory. I have called the file javascript.php, the class is called Helper_Javascript and has a static function that just returns "alert('sometext')" here it is class Helper_Javascript { public static function alert($message) { return "alert('$message');\n"; } } The problem is in my view or controller when I try to use the helper i just kepp getting the Class not

How do I call the trim function on a Kohana 3.2 validation object?

安稳与你 提交于 2019-12-07 13:51:38
问题 How can I call the trim function on a validation object in Kohana 3.2? I am using: $post = Validation::factory($this->request->post()); $post->rule('Email', 'trim'); 回答1: Validation objects are read only as of 3.2. Filter the input before creating the Validation object like so: $post = array_map('trim', $this->request->post()); // $post[key] = expression; if it is for one specific value $post = Validation::factory($post); // set validation rules etc 回答2: In addition to Darsstar reply - if you

Kohana URLs including index on redirects and pagination

断了今生、忘了曾经 提交于 2019-12-07 05:38:51
问题 I am having an issue with the KO3 core inserting index.php into my URL's when I use redirect Request::instance()->redirect('something'); or $paginationStuffHere->render(). The result of either of these is http://www.something.com/ index.php /something This is not an issue when I use full URL's for the redirects instead of relatives such as Request::instance()->redirect('http://www.something.com/something'); but there is not really a way to do this with the pagination functions... that I have