codeigniter

how to query group by and distinct with a limit in MongoDB PHP codeigniter?

▼魔方 西西 提交于 2019-12-25 07:35:16
问题 Is such a operation possible? sample record: { _id: ObjectId("51d6be147483c58419000002"), user: "ashok", action: "login", time: 1373027860, details: { user_entries: "blah..blah", url: "web.domain.com" } } Suppose, i want to group by url visited, for each user, group by url where user = "ashok", limit 10. I am using AlexBilbie library for MongoDB-Codeigniter (it doesnt have aggregation). so using plain php. Still even if I could aggregate, how to distinct or limit it? Any suggestion is welcome

302 Found Document Has Moved with CodeIgniter

久未见 提交于 2019-12-25 07:34:51
问题 I am working on a custom built CMS with codeIgniter. It works flawlessly in my localhost and on a account at bluehost. Now I have uploaded the site to ipage i get a strange error 0<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://igncms.safaapps.com/admin/login">here</a>.</p> <p>Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request.

Undefined Index for … existing index?

梦想的初衷 提交于 2019-12-25 07:33:16
问题 OK, that's more than weird... Here's my code : public function results($id,$pattern=3) { $this->load->library('session'); if (!$this->session->userdata('logged_in')) { $this->session->set_flashdata('return_url',$this->uri->uri_string()); redirect('log/in','refresh'); } else { $this->load->model('projects'); $proj = (array)$this->projects->getProjectById($id); print_r($proj); $progressPercentage = number_format((float)( ($proj['progress'] * 100) / $proj['total'] ), 2, '.', ''); } } Now, here's

PHP CodeIgniter: File doesn't get uploaded fast enough and it continues the process without the file

筅森魡賤 提交于 2019-12-25 07:25:42
问题 I have a submit file code that uploads an Excel file to my server and then uses it through the function. When doing so: if ($this->upload->do_upload()){ $data = array('upload_data' => $this->upload->data()); $filename = $data['raw_name']; $fullfilename = $data['orig_name']; $inputFileName = FCPATH."files/automation/1/$filename.xlsx"; $inputFileNameNew = FCPATH."files/automation/1/$filename-new.xlsx"; It gives me this output: Error loading file ".xlsx": Could not open /var/www/html/tools/files

Codeigniter pass variable to php file using json

三世轮回 提交于 2019-12-25 07:18:22
问题 I want to get data from database but I cannot pass variable from view to controller using json. Could you please help me to find the mistake. Here is my view: <?php echo $message; foreach($results as $row) { $faq_id = $row->faq_id; $faq_title = $row->faq_title; ?> <h3><a href="#" class="faq_title"><?php echo $faq_title; ?></a></h3> <?php } ?> Here is my JS file: $(".faq_title").click(function(){ var title = $(this).text(); $.ajax({ url: 'faq/get_faq_data', data: {'title': title}, dataType:

codeigniter complex join only if rows don't exist

感情迁移 提交于 2019-12-25 07:16:40
问题 I'm making a dating application, much like tindler. Users can like or dislike other users, and if two users both like each other they get the option to chat with eachother. Currently building the query to pull a random profile and one of their pictures at random: $data = $this->db ->select('users.id,display_name,city,state,gender,users_pictures.picture') ->join('users_pictures','users_pictures.user_id = users.id') ->order_by('id','RANDOM') ->limit(1) ->where(array('users.approved'=>1,'users

No DB connection with MAMP and MSSQL (SQL Server), using CodeIgniter

穿精又带淫゛_ 提交于 2019-12-25 07:12:35
问题 I'm running MAMP 3.0 on OS X and trying to connect to a remote SQL Server DB with no luck. I've followed what I could from other support questions regarding getting mssql enabled in my MAMP php install. Everything appears to be correct, mssqlsupport shows as enabled in phpinfo() The project is in CodeIgniter using the sqlsrv driver, and when running a db connection test I get nothing on screen and no errors in my MAMP logs or my CI logs. All debugging and error reporting appears to be turned

codeigniter multiple inputs in table

你。 提交于 2019-12-25 07:08:59
问题 i have 2 inputs with same name this is my view <input type="text" class="form-control" name="serv[]" > <input type="text" class="form-control" name="serv[]" > <input type="hidden" id="dr_id" name="d_id"> my controller function is public function submit_2() { $data = array( 'service_name' => $this->input->post('serv'), 'dr_id' => $this->input->post('d_id'), ); $this->insert_model->service_insert($data);} my model is function service_insert($data){ $this->db->insert('services', $data); } i am

Prevent session time out if javascript timer is running

。_饼干妹妹 提交于 2019-12-25 06:58:23
问题 I have a web application made in Code igniter. What it basically does is - user logs in to the application User can do various tasks, one of which is timer based tasks. There is a button which starts the javascript timer While timer is running he performs certain tasks, and once he is done, he stops the timer. The timer may run for few minutes to few hours. My Question - While JavaScript timer is running, can we prevent session timeout, so that users are not logged out and their progress is

The custom font does not work.Codeigniter

心已入冬 提交于 2019-12-25 06:55:52
问题 I want to added custom font in my app, but it does not work. Here it is path when font located @font-face { font-family: PF Din Text Cond Pro; src: url('/fonts/JtNLnKEa.ttf'); } font located in system/fonts/JtNLnKEa UPD @font-face { font-family: PF Din Text Cond Pro; src: url('http://contrast-energo.ru/fonts/JtNLnKEa.ttf'); } body,html { font-family: PF Din Text Cond Pro; height: 100%; min-height: 100%; margin-top: 0px; } How fix? Sorry for my bad English 回答1: Add your font a directory