codeigniter

passing php variable from controller to javascript function in the head of a view

你说的曾经没有我的故事 提交于 2020-01-18 05:45:34
问题 I would pass two php variables from a codeigniter controller to a javascript function located to the head of my view. is it possible to do such thing? 回答1: yeah sure, just echo the javascript: <?php echo '<script>var myPhpVariable = "'. $my_var . '";</script>'; ?> 回答2: or just set in your controller your variables eg - in the controller $data['newvar'] = $myvar_in_the_controller; and then in the view in the javascript <?php echo $newvar ?> 回答3: I have been developing a page that requires

How to use for-each loop when inserting arrays into mysql using Codeigniter?

↘锁芯ラ 提交于 2020-01-17 13:41:47
问题 Im trying to add dtnamic fileds and through that insert arrays data into mysql but when i try this code nothing error and ref no only inserting can anyone help me . im using Codeigniter framework. This is my view page : my form with js <div id="invoice_form"> <?php echo form_open(base_url().'sample/myinvoice'); ?> <div><?php echo form_input(array('id'=>'ref','name'=>'ref'));?></div> <div id="description"><p id="add_field">ADD DESCRIPTION</p></div> <input id="btn_add" name="btn_add" type=

Calculating Time Differences

谁都会走 提交于 2020-01-17 11:15:40
问题 I tried using DateTime in PHP and used diff method to find the time difference between a timestamp and the current time. However PHP gives me the wrong difference. Can anyone point out to me what went wrong in my code? Thanks! PHP Code function time() { $now = new DateTime; $later = new DateTime('2011-10-17 07:08:00'); $interval = $now->diff($later); echo $now->format('y m d'); echo "<br>"; echo $later->format('y m d'); echo "<br>"; echo $interval->format('%a'); } Output 11 10 19 11 10 17

Calculating Time Differences

不羁的心 提交于 2020-01-17 11:13:45
问题 I tried using DateTime in PHP and used diff method to find the time difference between a timestamp and the current time. However PHP gives me the wrong difference. Can anyone point out to me what went wrong in my code? Thanks! PHP Code function time() { $now = new DateTime; $later = new DateTime('2011-10-17 07:08:00'); $interval = $now->diff($later); echo $now->format('y m d'); echo "<br>"; echo $later->format('y m d'); echo "<br>"; echo $interval->format('%a'); } Output 11 10 19 11 10 17

Calculating Time Differences

自闭症网瘾萝莉.ら 提交于 2020-01-17 11:13:10
问题 I tried using DateTime in PHP and used diff method to find the time difference between a timestamp and the current time. However PHP gives me the wrong difference. Can anyone point out to me what went wrong in my code? Thanks! PHP Code function time() { $now = new DateTime; $later = new DateTime('2011-10-17 07:08:00'); $interval = $now->diff($later); echo $now->format('y m d'); echo "<br>"; echo $later->format('y m d'); echo "<br>"; echo $interval->format('%a'); } Output 11 10 19 11 10 17

Session does not invalidating in old facebook iframe app

孤人 提交于 2020-01-17 07:36:39
问题 I am facing a very strange issue. I have developed a Facebook iframe application almost a year back. I am using facebook-php-sdk for getting logged in user session and other details. I recently made some changes and used the new facebook OAuth based API. But I am now facing a problem, when user logs out from Facebook, still my iframe app is able to access its facebook session. The problem is only reproducible in IE. I am using CodeIgniter framework and have referred this post. Here is the

Session does not invalidating in old facebook iframe app

Deadly 提交于 2020-01-17 07:36:29
问题 I am facing a very strange issue. I have developed a Facebook iframe application almost a year back. I am using facebook-php-sdk for getting logged in user session and other details. I recently made some changes and used the new facebook OAuth based API. But I am now facing a problem, when user logs out from Facebook, still my iframe app is able to access its facebook session. The problem is only reproducible in IE. I am using CodeIgniter framework and have referred this post. Here is the

How to insert multiple records to database in Codeigneitor at same time

守給你的承諾、 提交于 2020-01-17 06:06:34
问题 I want to insert some values to the database where i have got those values by doing some calculations.so right now i can view those values in a html report.but what i want to do is insert those multiple values to the database.there are 50 persons.so i want to add all the details of these 50 persons at same time by just clicking a button.how can i do this?what could be my controller view and model. Here are the values that i get after the calculations in controller $sheet_data[] = array(

How to insert multiple records to database in Codeigneitor at same time

做~自己de王妃 提交于 2020-01-17 06:06:26
问题 I want to insert some values to the database where i have got those values by doing some calculations.so right now i can view those values in a html report.but what i want to do is insert those multiple values to the database.there are 50 persons.so i want to add all the details of these 50 persons at same time by just clicking a button.how can i do this?what could be my controller view and model. Here are the values that i get after the calculations in controller $sheet_data[] = array(

session php with ajax innerHTML shopping cart's quantity order

雨燕双飞 提交于 2020-01-17 05:21:11
问题 I'm building shopping web application. the thing that I want is, when user click Add to cart's button, the quantity order will update instantly on the shopping/product.php page My Update quantity order's logic is in the "add method" controller page. public function add() { // Set array for send data. $insert_data = array( 'id' => $this->input->post('id'), 'name' => $this->input->post('name'), 'price' => $this->input->post('price'), 'qty' => 1 ); // This function add items into cart. $this-