codeigniter

Can i Use validation rules in CI on the same element twice

回眸只為那壹抹淺笑 提交于 2020-01-06 15:11:25
问题 I Have Defined my all rules in a form_validation file in config file e.x $config = array( 'basic' => array( array( 'field' => 'name', 'label' => 'Name', 'rules' => 'alpha' ), array( 'field' => 'age', 'label' => 'Age', 'rules' => 'alpha' ), array( 'field' => 'city', 'label' => 'City', 'rules' => 'alpha' ) ), 'mandate' => array( array( 'field' => 'name', 'label' => 'Name', 'rules' => 'required' ), array( 'field' => 'age', 'label' => 'Age', 'rules' => 'required' ), array( 'field' => 'city',

Not able to save generated pdf on my remote server

跟風遠走 提交于 2020-01-06 15:04:52
问题 I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email Here is my code generate and save pdf public function email($timestamp=0, $load_id=0, $type=0){ $this->load->library('tcpdf/Pdf'); $pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false); $pdf->SetTitle('Document'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetHeaderMargin(10); $pdf->SetLeftMargin(10); $pdf->SetRightMargin(10); $pdf->SetTopMargin(10);

Code Igniter URL appending

左心房为你撑大大i 提交于 2020-01-06 15:04:33
问题 This is my first question, I am new at CodeIgniter and trying to run a login code at XAMPP server. I have two views. myform.php <html> <head> <title>My Form</title> </head> <body> <?php echo validation_errors(); ?> <form id="myform" method="post" action="/form/myform" title="Create an Account"> <h5>Username</h5> <input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" /> <h5>Password</h5> <input type="text" name="password" value="<?php echo set_value('username

Not able to save generated pdf on my remote server

时间秒杀一切 提交于 2020-01-06 15:03:11
问题 I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email Here is my code generate and save pdf public function email($timestamp=0, $load_id=0, $type=0){ $this->load->library('tcpdf/Pdf'); $pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false); $pdf->SetTitle('Document'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetHeaderMargin(10); $pdf->SetLeftMargin(10); $pdf->SetRightMargin(10); $pdf->SetTopMargin(10);

CodeIgniter - MySQL Error 1064 (Update table1 inner join table2(…))

孤者浪人 提交于 2020-01-06 14:55:12
问题 Is now 6am in the morning and i'm still struggling to execute a query with the CodeIgniter PHP framewok. Hope you guys can help me Code: $query=' UPDATE `STUDY_LIST_AUX` INNER JOIN `study_report` ON `STUDY_LIST_AUX.study_iuid`=`study_report.study_iuid` SET `STUDY_LIST_AUX.report_date`=DATE_FORMAT(`study_report.report_date`,\'%Y-%m-%d %h:%i:%s\'), `STUDY_LIST_AUX.report_status` = `study_report.report_status` '; if ($this->db->query($query)) { echo "True!<br><br>"; } else { echo "False<br><br>"

Data insertion with junction tables

旧时模样 提交于 2020-01-06 14:50:51
问题 I'm working on my first major database design with junction tables in CodeIgniter, and I'm not too sure how to handle data insertion. Let's say I have two tables, some_table & another_table , with a junction table, some_another . Now if I want to add a record to some_table , do I also write separate insertion queries for the junction table, or is there a better, more automated way to handle this? For example, do I have to do this: INSERT INTO some_table (col1, col2, col3) VALUES (val1, val2,

codeIgniter Javascript alert with success message on click ok page refresh

老子叫甜甜 提交于 2020-01-06 14:26:26
问题 I have a code like this: <div class="alert alert-success"> <a class="close" data-dismiss="alert">×</a> <?php $message = "Your Upload was successful"; if((isset($message))&&($message!='')){ echo '<script> alert("'.str_replace(array("\r","\n"), '', $message).'"); </script>'; } redirect($this->uri->uri_string()); //refresh page ?> I want to show this success alert message and then if the user click on OK it will refresh the browser. In my case it is just refreshing the browser. What will be the

How do I create an array for a range of values with keys using php?

廉价感情. 提交于 2020-01-06 14:12:52
问题 I am using CodeIgniter. I want to create an array to add to a dropdown which contains the numbers 1 -> 1000. I have tried the php range() function like so $arr = range(1,1000); It worked and create a dropdown from 1 to 1000. I do have one problem though. When select text 1 from my drop down and post, the posting value is 0 . Because by default the keys are starting from 0 and the key is set to the dropdown value Here is part of my drop down HTML <select id="user-day" class="dropdown-small

How do I create an array for a range of values with keys using php?

馋奶兔 提交于 2020-01-06 14:12:08
问题 I am using CodeIgniter. I want to create an array to add to a dropdown which contains the numbers 1 -> 1000. I have tried the php range() function like so $arr = range(1,1000); It worked and create a dropdown from 1 to 1000. I do have one problem though. When select text 1 from my drop down and post, the posting value is 0 . Because by default the keys are starting from 0 and the key is set to the dropdown value Here is part of my drop down HTML <select id="user-day" class="dropdown-small

CodeIgniter autoloaded models' variables are lost after an AJAX call

与世无争的帅哥 提交于 2020-01-06 13:57:49
问题 I've been creating an application that requires buttons to make an ajax call to a controller that uses autoloaded models. I was under the impression that variables in an autoloaded model would retain their values after an Ajax call, but for some reason the entire model (including their variables) have lost their new values. Am I misunderstanding the way the autoload function works, or does it have something to do with me using Ajax? Code for reference below. Autoload: $autoload['model'] =