Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all 14176 articles
Browse latest View live

how to return multi array in select array codeigniter 3.2

$
0
0
i have function below


$arr_in=$this->getarrayid($id);
//$id print_r($arr_in)
PHP Code:
Array
(
 
   [0] => 11
    
[1] => 36
    
[2] => 41  


PHP Code:
public function demo($id)
    {
 
           $arr_in=$this->getarr_questionid($id);
            
$countarrcount($arr_in);
            
$rs=array();
            for(
$i=0;$i<$countarr;$i++){
                
            
$this->db->where('question_id',$arr_in[$i]);
            
$q=$this->db->get('answer_true');
            
$rs=$q->result();
        }
               return 
$rs;
    } 
function above when i return only one array
when i print_r($rs) array show all array
plz,  how to fix to return multi array

Looking for top codeigniter developer in SF Bay Area

$
0
0
Hello,

  I own a company in the San Francisco area that has a nicely built content management system. I have had our original developer work on it for the last few years but his communication is unlike anything I've seen before. As of lately it is extremely poor and I need someone who I can throw cash at to develop elegant, secure code. 

I am looking for someone not only with a lot of experience, but someone maybe frequent to these forums with a good reputation. 

We have a large budget. I need GOOD help. I've already had a couple of dreamers try to help, but they simply were just terrible programmers. 

Please email me at preferredhvac@yahoo.com

Thank you

Unit testing with codeigniter 2.2

$
0
0
Hello all,

I am taking over an existing application in codeigniter 2.2 and I have to perform unit testing. What are the possible frameworks available to integrate codeigniter 2.2 with phpunit? Also, is there a unit_test class for codeigniter 2.2? I have been trying to find a solution for the past three days and no luck yet.

Name of project in prod url

$
0
0
Hi

My project is http://localhost/project
and I would like to have the name of the project in production url

How can I make this work ?

.htaccess
Code:
   RewriteEngine On
   RewriteBase /project/

config.php
PHP Code:
$config['base_url'] = 'http://localhost/project/'

This configuration doesn't works.
Any idea ? is it possible ?

Why a configuration like this ? Because I have some javascript files like list:
Code:
              // Définition des variables selon la page
               var pathArray = window.location.pathname.split( '/' );
               var uri_1 = pathArray[2];
who's works fine in local but can't works in prod because the name of project is not in the url...

How to fix function to return multi array ci 3

$
0
0
i test with function below

PHP Code:
public function getexam_result($bode)
    {
        foreach(
$bode as $v)
 
       {
         
 $this->db->where('question_id',$v);
         
 $q=$this->db->get('answer_true');
         
 $rs=$q->result();
 
         $ans=array();
 
         foreach($rs as $v1)
 
         {
 
           $ans[]=$v1->answer_id;
 
         }
 
           return $ans;
 
       }
 
  
if i return  it only one array
PHP Code:
Array
(
 
   [0] => 1
    
[1] => 2


when i print array $ans it show array
PHP Code:
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 1
    
[1] => 3
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
<
pre

how to fix to return multi array
thank you in advance

How to autoload helper functions in codeigniter 4

$
0
0
I just downloaded CodeIgniter 4 from their official GitHub. They changed a lot from CodeIgniter 3. I want to use base_url() function in the view and for that, you need to load URL helper and in CodeIgniter 3 i autoloaded it in config/autoload.php file. But now they have entirely changed the structure of config/autoload.php file in CodeIgniter 4 and it is very confusing to me.
You can still use the base_url() function in your views in CodeIgniter 4 by using below code in your constructor of controller 
Code:
helper('url');

If anybody who used CodeIgnter 4 knows how to autoload helper functions like url by modifying autoload.php file please help me.

Error on activating CSRF protection

$
0
0
I'm getting the following error message when I set $config['csrf_protection'] = TRUE:



Code:
Fatal error: Class 'CI_Controller' not found in /opt/codeigniter/system/core/CodeIgniter.php on line 369
A PHP Error was encountered

Severity: Error

Message: Class 'CI_Controller' not found

Filename: core/CodeIgniter.php

Line Number: 369

Backtrace:

I'm following the manual, but I can't see clear cause for it.

By the way, it only happens when I try to reload by F5 a FORM submited with POST. I know that an error is expected, but I think that it should be shown in an error page (or something), and might be another kind of error.

Anyone can help me out?

Modular separation and CI 3.1.3

$
0
0
Candlecms and codeIgniter 3.1.3
(Gbobard, 2017-01-22 19:39:52)



Good evening,

Since version 7 of PHP, BYOOS has entered a series of testing its software production or software package with several patches to support it.

CandleCMS is a content manager linked to the Framwork CodeIgniter currently in version 3.13 then of the CMS NO-CMS currently in version 1.1.3c the transition from PHP5.6 to PHP 7 poses no problem with CI 3.1.2 but the version of CI 3.1 .3 imposes a small update because the CI_Loader -> _ ci_object_to_array () method is replaced by the CI_Loader -> _ ci_prepare_view_vars method. This method is used in the module manager of Wiredesignz Modular Separation

FIX

At the application / third_party / MX / loader.php level replace the old method with _ci_prepare_view_vars on line 294

Gabriel


Http://byoos.net/candlecms/blog/Candlecm...313_1.html

Message: Cannot modify header information - headers already sent by (output started a

Static pages [Solved]

$
0
0
I want to display the content from my database in pages as home, about, terms,privacy,etc.

If somebody knows how to create new pages, please reply me Sad 


This is my database
[Image: 3c5b4316bcb17a3c7166fb71edc72100o.jpg]

here is my controller:

PHP Code:
class Paginas extends CI_Controller {
    
        
public function 
about(){

        
$data['title'] = 'About';
        
$data['paginas'] = $this->paginas_model->get_paginas();
//              check connection, not working.
//        print_r($data['paginas']);
        
 
       $this->load->view('templates/head'$data);
    
$this->load->view('templates/navbar'$data);
 
       $this->load->view('paginas/about',$data);
 
       $this->load->view('templates/footer'$data);
 
       
        
}
        


here is my model:

PHP Code:
    class Paginas_model extends CI_Model{
        
// Connect to database //
        
public function __construct(){
            
$this->load->database();
            }
            
        
// Get Paginas from database //
        
public function get_paginas($slug=FALSE){
            if(
$slug===FALSE){
                
$query=$this->db->get('paginas');
                return 
$query->result_array();
                }
                
                
$query=$this->db->get_where('paginas', array('slug'=>$slug));
                return 
$query->row_array();
            }
            
        } 

here is my view:

PHP Code:
<div class="container" id="main">
<
div class="row">
<
div class="col-md-8 animated fadeIn">
<?
php foreach($paginas as $page) : ?>
<p><?php echo $page['contenido']; ?></p>
<?php endforeach ?>

<h4>Our Mission</h4>
<p>To provide the most actionable app store data.</p>

<p>At Apptopia, we all come to work every day because we want to solve the biggest problem in mobile. <b>Everyone is guessing</b>. Publishers don’t know what apps to build, how to monetize them, or even what to price them at. Advertisers &amp; brands don’t know where their target users are, how to reach them, or even how much they need to spend in order to do so. Investors aren’t sure which apps and genres are growing the quickest, and where users are really spending their time (and money).</p>

<p>Throughout the history of business, people use <b>data</b> to make more informed decisions. Our mission at Apptopia is to make the app economy more transparent. Today we provide the most actionable mobile app data &amp; insights in the industry. We want to make this data available to as many people as possible (not just the top 5%).</p>

</div>
$this->load->view('templates/kk'); 
</div>
</div> 

Why this error appears stdClass::$pic_item?

$
0
0
site/views/index.php


          <?php foreach($pic as $pic_item): ?>
          <img src="<?php echo base_url('assets1/images/slider/'.$pic_item->pic_item );?>">                   
          <?php endforeach;?>


controllers/Cspages.php

  1.     public function index()    {                $this->load->helper('url');                $this->load->model('gallery_model');                $pic_unique_id = 18;  // slider                $data['pic'] = $this->gallery_model->get_picture($pic_unique_id);                            $this->load->view('index', $data);    }
models/Gallery_model.php


  1. public function get_picture($pic_unique_id)    {                      $query = $this->db->get_where('galleries_pictures', array('picture_unique_id' => $pic_unique_id));        return $query->result();         }
Hello,

How to handle this error message?


A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$pic_item
Filename: views/index.php
Line Number: 214
Backtrace:
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\site\views\index.php Line: 214 Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\site\controllers\Cspages.php Line: 31 Function: view
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\index.php Line: 315 Function: require_once
http://localhost/masterlinkci2/assets1/images/slider/"> }


views/index.php

Line Number: 214


<img src="<?php echo base_url('assets1/images/slider/'.$pic_item->pic_item );?>">

How many pets do you own?

$
0
0
I have 2 dogs and both Shi Tzu breed and a tabby cat. So what pet(s) do you have Smile Big Grin  

Multiple Applcation Question

$
0
0
I have to applications using the https://www.codeigniter.com/user_guide/g..._apps.html way

How ever when I type in example.com/admin on the index.php how can I make sure the application folder switches over to admin

$application_folder = 'application/admin';

$application_folder = 'application/catalog';

htdocs > cms     application/admin/
                application/admin/cache/
                application/admin/config/
                application/admin/core/
                application/admin/controllers/
                application/admin/helpers/
                application/admin/hooks/
                application/admin/language/
                application/admin/libraries/
                application/admin/logs/
                application/admin/models/
                application/admin/third_party/
                application/admin/view/
                application/catalog/
                application/catalog/cache/
                application/catalog/config/
                application/catalog/core/
                application/catalog/controllers/
                application/catalog/helpers/
                application/catalog/hooks/
                application/catalog/language/
                application/catalog/libraries/
                application/catalog/logs/
                application/catalog/models/
                application/catalog/third_party/
                application/catalog/view/

[split] integrate MS-SQL with CI 3.1

$
0
0
How can i integrate MS-SQL with CI 3.1
I am not able to build the queries with active records.

I want to migrate from mysql to mssql.
I am using sqlsrv driver but CI is not building the query
Server: IIS
Fatal error: Call to undefined method CI_DB_sqlsrv_driver:Confusedelect()

UserBundle for CI 3.x

$
0
0
Hi all, there is a new UserBundle for CodeIgniter 3.x available.

It contains :
- Login
- Signup
- User
- Users
- Passwordforgot
- Route Authentification
- Database Entity Configuration

If you like please test it and tell me whats wrong, whats good or what
can i make better.

Here is th Github link:
https://github.com/chrobaks/CI-UserBundle/

in MySQL- Trigger how to use codeigniter Path

$
0
0
Dear All,

I am using - PHP-Codeigniter 2.1.3, MySQL , XAMPP


In MySQL table i added a trigger, In that trigger i want to assign my CONTROLLER Path, if any data insterted into the Table immediately display a PAGE as follows. but showing errors. Highly expecting your kind support…..!!!

Code:
BEGIN
IF NEW.flag = 1 THEN
  DECLARE result CHAR(255);
  SET cmd = CONCAT('E:/xampp/php/php.exe -f "E:/xampp/htdocs/DEN/classes.php"');
END IF;
END

[ASK-help] Multiple Insert data get 504 gateway timeout

$
0
0
i have this code for multiple insert data and check data before insert,
example i have 400 row data, and when i try to run this script


PHP Code:
//get data tenant from tipe utilitas
            
$tenant $this->standmeter_model->get_data_meter($idunit$bulk_tenant$kode_ruang);
            
//$total = $this->standmeter_model->count_get_data_meter($idunit, $bulk_tenant, $kode_ruang);

            
$data_save = array();

            foreach (
$tenant as $row => $value
            {
                
                if(
$this->master_model->cek_yes_or_no('tr_meter_listrik', array('idunit'=>$idunit'idruang'=>$value['idruang'], 'substr(periode,1,7)'=>substr($periode,0,7))) === FALSE)
                {
                    
//get last standmeter
                    
$data_meter $this->master_model->get_by_id_select_where_array('tr_meter_listrik''meter_akhir', array('idunit'=>$idunit,'idruang'=>$value['idruang'], 'periode' => $periode_sebelumnya))->row_array();

                    
//get data from ruang
                    
if(empty($data_meter['meter_akhir']))
                    {
                        
$ruang $this->master_model->get_by_id_select_where_array('ms_ruang''meteran_'.$label.'_akhir', array('idruang'=>$value['idruang'], 'idunit'=>$idunit))->row_array();
                        
$meter_akhir $ruang['meteran_'.$label.'_akhir'];
                    }
                    else
                    {
                        
$meter_akhir $data_meter['meter_akhir'];
                    }

                    
$data_save[] = array(
                        
'id_meter' => 'EL'.$row.'_'.$idunit.'_'.now(),
                        
'idtenant' => $value['idtenant'],
                        
'idruang' => $value['idruang'],
                        
'idunit' => $idunit,
                        
'kode_ruang' => $value['kode_ruang'],
                        
'periode' => $periode,
                        
'tgl_awal' => $tgl_awal,
                        
'tgl_akhir' => $tgl_akhir,
                        
'meter_awal' => $data_meter,
                        
'faktor_meter' => '1',
                        
'created_at' => date('Y-m-d H:i:s')
                        );
                }    
            }

            
$this->db->insert_batch('tr_meter_listrik'$data_save); 
 

when the proses, the data can insert to DB but the browser/application get "504 Gateway Time-out";

[Image: d8210a11c97b4365b30004e777722367.png]
how i can optimize the application to be fast prosess and not get 504 error, thanks

Workflow Engine for CodeIgniter

$
0
0
Which workflow engine can we use with CodeIgniter and How to integrate the workflow with web app?

change GET query string

$
0
0
Hi,

I search page which gets filter using GET method. in some cases I can get  ?brand=&model=2   this kind of query where brand is empty. 
When I get this kind of get string I want remove 'brand'  from get field so it will be ?model=2 . 
In other words when user make query url ?brand=&model=2 as a response url I want to be it ?model=2

I dont know how to do it.

Thanks in advance

i want to change home page url

Viewing all 14176 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>