codeigniter

pass variable from javascript function to controller method in codeigniter

做~自己de王妃 提交于 2019-12-24 18:53:26
问题 I'm new in CodeIgniter. I am making a project in which I make a javascript function in view an in this I define a variable .. it looks like this var $rowCount=0; function invest() { $rowCount=$('#ulinvestment').find('.rowInvestment').length; } my controller function contains function input(parameter //i want to pass $rowcount value here ){ $this->load->helper('form'); $this->load->helper('html'); $this->load->model('mod_user'); $this->mod_user->insertdata(); } I want to access the variable

Codeigniter Routes for filename with extension

老子叫甜甜 提交于 2019-12-24 18:38:52
问题 I am using codeigniter and its routes system successfully with some lovely regexp, however I have come unstuck on what should be an easy peasy thing in the system. I want to include a bunch of search engine related files (for Google webmaster etc.) plus the robots.txt file, all in a controller. So, I have create the controller and updated the routes file and don't seem to be able to get it working with these files. Here's a snip from my routes file: $route['robots\.txt|LiveSearchSiteAuth\.xml

Codeigniter - Clone Data (But remove 1 column that is not exist )

不羁的心 提交于 2019-12-24 18:15:07
问题 What i am trying to do: Try to Clone Data (Update) from Table "Payment History" to "Payment" , But the problem right now is that in Payment History Table there is "PaymentHistory_ID" column , how do I ignore it ? Payment Table Payment_ID Payment_Amount Payment_Method Payment_Remark Payment History Table Payment_ID PaymentHistory_ID Payment_Amount Payment_Method Payment_Remark Both have the same column and same data type My Code: Controller public function updateHistory($Payment_ID){ $query =

How to get the data using >= AND <= in a 12hr time format in php/mysql?

我的未来我决定 提交于 2019-12-24 18:06:09
问题 I want to get the time from 12:00:00 PM to 02:00:00 PM but it doesn't work when I use start_time >= '12:00:00' AND end_time <= '02:00:00' . I have this code so far. Note: I'm using Code Igniter. $start = date("g:i:s", strtotime($this->input->post('start'))); $end = date("g:i:s", strtotime($this->input->post('end'))); $date_reserve = $this->input->post('date_reserve'); $sql = "SELECT materialID FROM schedule WHERE date_reserve = ? AND start_time >= ? AND end_time <= ?"; $query = $this->db-

Can't use CodeIgniter's LIKE()

和自甴很熟 提交于 2019-12-24 17:53:05
问题 Because of some bug or my lack of knowledge in ODBC connections I can't use CodeIgniter's $this->db->like(); (If you really want to know why I can't use it, see my other thread here.) How do I replace $this->db->like("name", 'a', 'after'); with some other safe code? EDIT: Obviously, I wasn't clear in my description. I KNOW how to use "like()". My problem is that I CAN'T use it because of other circumstances. What I need is a substitute for "like()". I know I could do it like: $this->db->where

Codeigniter AutoLoad DB, But have ability to check if connection exists

别来无恙 提交于 2019-12-24 17:50:01
问题 How would I autoload the database using autoload.php I already got the autoloading of course... that's the easy part. But also allowing me to check if the db has been connected to, and if not, to display a specific page saying something like "We are sorry but our database is currently unavailable." Would it have to be some kind of custom hook that I would have to make? 回答1: You can edit the error template in application/errors/error_db.php to use your custom message. Maybe use the ENVIRONMENT

Codeigniter duplicate elements from the database

痞子三分冷 提交于 2019-12-24 17:27:17
问题 I've got a page that contains 4 products loaded from the database, when you scroll down you get 4 more products every time. This products are loaded in a random way, the problem are the duplicate products. This is the line that I used into the model: $this->db->order_by('productID', 'RANDOM'); Without this line everything works fine. I can't use limit set to 1 because I've got: $query = $this->db->get('product', 4, $offset); There's a simple way to solve this problem? I've to do an array that

How write this complex query in codeigniter?

家住魔仙堡 提交于 2019-12-24 17:20:08
问题 I use mysql and try to write this query into a model of Codeigniter. This query run perfectly in phpmyAdmin. SELECT a.ar, a.jabatan, COUNT(*) AS JumlahWPBaru, SUM( CASE WHEN a.no_shim IS NOT NULL THEN 1 WHEN a.no_shim IS NULL THEN 0 END ) AS JumlahHimbauan FROM ( SELECT a.ar, c.jabatan, a.npwp, a.kpp, a.cab, a.namawp, b.kd_shim, b.no_shim, b.tgl_shim FROM mfwpbudi a LEFT JOIN tb_shimbauan b ON ( a.npwp = b.npwp ) LEFT JOIN easystp_user c ON ( SUBSTR( a.ar, 1, 9 ) = c.id_user ) WHERE a.tanggal

Flashdata not getting cleared in Codeigniter

让人想犯罪 __ 提交于 2019-12-24 16:35:25
问题 I am using Codeigniter 2.1.4 and I have facing some issues with flashdata. When I successfully submit record I can display the flashdata message. But if go to the other page from the page where flashdata message was displayed and then go back to previous page using browser back button it shows me flashdata message again. How to clear flashdata message once it used? I think its not the flashdata issue its cache problem. I am confused why this is happening. If its cache issue then how to remove

Mod_rewrite http->https redirect EXCEPT one URL

99封情书 提交于 2019-12-24 16:00:52
问题 OK, so I'm trying to do this: !www -> www http -> https EXCEPT /[a-f0-9]{11}/ https://www.domain.com/[a-f0-9]{11}/ -> http://www.domain.com/[a-f0-9]{11}/ map to controller: index.php?(uri) e.g. /controller/action/id -> index.php/controller/action/id Summary: all URLs should be https://www.domain.com/(.*) except /[a-f0-9]{11}/, which should be forced to http only. I have an old set of rules (see below) which don't look very clean. I've tried adding to them to account for /[a-f0-9]{11} and it