CodeIgniter

35

Solutions

48

Contributors

Share tech news, updates, or what's on your mind.

Sign up to Post

Hello! I'm trying to select some information from my database using drop-down lists, but when I pass my variables from my controller to the view, I get the "undefined variable" error. I can't understand why I get this error, because I've implemented other functions in a similar way and they worked. Also, I know the function in the model works, because I get my info using print_r.

This is my controller function.


This is my model function.


This is my view.
this is my view
This is the error I'm getting.
error.PNG
And this is what I get when I use print_r to see what my function in the controller is returning. It's correct,  just can't post it.
snip.PNG
Please, help me!
0
Cloud Class® Course: Microsoft Windows 7 Basic
LVL 12
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Hi All,

I am changing my http to https then session are not working when i am using codeigniter(PHP Frame work)

Please give me solution of my problem.

Thanks all.
0
This is what I am working with:

  • Window Server 2016
  • SQL Server 2017
  • IIS 10
  • Codeigniter 3

This is what I have done:

Installed IIS URL Rewrite 2.1

Modified the web.config file that is located in the application folder:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
    <rules>
        <rule name="Index">
            <match url="^(.*)$"/>
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}"/>
        </rule>                
    </rules>
</rewrite>
</system.webServer>

Open in new window


Modified the config.php file:

$config['base_url'] = 'http://10.10.0.4/portalci/';
$config['index_page'] = '';

Open in new window


Modified the autoload.php file:

$autoload['helper'] = array('url');

Open in new window


The results:

When I go to http://10.10.0.4/portalci/index.php it works fine. When I remove the index.php I get the following error: 403 - Forbidden: Access is denied.

Thanks in advance for your help!

Side note: I have spent the last 16 hours and reviewed hundreds of other post to try to resolve this myself.
0
I am working with some folk who are using Expression Engine Version 2. something.  They are considering upgrading to the latest version.  I know that version 2 and version 3 have a different directory setup.  Is there any definitive docs on how to upgrade with minimal pain? Tutorials? Plugins? How to videos?  I'm in the exploratory phase of this project and will appreciate any input on upgrading EE from 2.... to 3.0 - 4.0 and beyond!
0
I have an admin panel in codeigniter project.
There is a sidebar (<ul> <li>xxxxxx</li> </ul>) at the left and the content area in the right.
I store the content of the relevent option of sidebar in a variable , i.e the whole view and show inside a particular div in the right side content.
The functionality is working , but i want to do this without page load (i.e, by using ajax)
Here is the code in my master page
But it does not seem working

I shall be thankful if you kindly look into the issue

<script>
$(document).ready(function(){
 $('#a1').click(function(e){
            //alert("ok");
        e.preventDefault(); //To prevent the default anchor tag behaviour
        var url = this.href;
        //alert(url);
        $(".content").load(url);
        $('.content').load(<?php $this->load->view('admin/manage_student_form',$data, TRUE); ?>);
 });
 });
</script>
0
how code update image and display current image if i don't want to update the image using CodeIgniter version 2.2.6 ?
0
I have a list in Flexigrid and the edit form in a different page. Problem is after edit process is completed I would like to return the same page number from which row is edited. Instead it always goes to the first page of the list.

All of the this done in Codeigniter., after searching for a while I got below solution but still I am not sure how to get to the history page from the edit is clicked.

$('#MyFlex') .flexOptions({ url: urlAction, newp: 1 }).flexReload();

Open in new window

0
Hello,

I have piece of code here. I am trying to create something like a quiz application. In  <h4>Add question</h4> part, I can add a question if I want to and I store all the details I entered into the database by making an ajax call. Upon success, this piece of code gets replaced by the same code with other data so that the user can enter all the details. What I am trying to do is once I add a question in 'Add question' part, then I should be able to display it throughout the quiz. How can I do a post for new_questions in ajax and send it to the controller?

Can anyone suggest me how to do proceed with this?

Any kind of suggestion would be helpful.
   
<?php
foreach($substeps as $row) {
 ?>
 <div id='img_div'>
      <h2 id="stepslist_<?php echo $row->stepid;?>" class="step"><p><?php echo $row->stepname;?></p></h2>
      <img src='http://localhost/project/uploads/<?php echo $row->image; ?>'>
</div>
<?php } ?>
 <?php
      foreach($questions as $each){
      ?><br><br>
      <input type="text" name="questions[]" class='form-control' id="questions_<?php echo $each->questionid; ?>"  value="<?php echo $each->questionname; ?>" disabled/><br/>
   
    <h4>Add question</h4>
    <input type="text" class="form-control" name="newquestion[]"  id="new_questions_<?php echo $each->questionid; ?>" /><br>
    <h4>Answer:</h4>  <select class="form-control" name="answer[]" id="answer" required>
 <option value="">Select</option>
 <option value="no">no</option>
 <option 

Open in new window

0
I did tutorial located here:, what i would like to do is add edit functionality, i would like to have an edit button and be able to edit record, the tutorial did no cover this, i have researched but i just cant wrap my head around it, i am new to codeigniter as you can tell.

here is my controller:
<?php

class Site extends CI_Controller
{

	function index()
	{

		$data = array();
		
		if($query = $this->site_model->get_records())
		{
			$data['records'] = $query;
		} 
		//$this->load->library('table');
		$this->load->view('options_view',$data);
	}

	function create()
	{
		$data = array(
			'title' => $this->input->post('title'),
			'content' => $this->input->post('content')
			);

		$this->site_model->add_record($data);		
		$this->index();
	}

	function update()
	{
		$data = array (
			'title' => 'My NEW UPDATED title',
			'content' => 'NEW UPDATED content; UPDATED'
			);
		$this->site_model->update_record($data);
	}

	

	 function delete()
	 {
	 	$this->site_model->delete_row();
	 	$this->index();
	 }

}

?>

Open in new window


Here is my model:
<?php

class Site_model extends CI_Model {

	function get_records()
	{
		 $query = $this->db->get('assets');
		 return $query->result();
		// $query = $this->db->query('SELECT * FROM assets');
	    //echo $this->table->generate($query);

	}


	function add_record($data)
	{
		$this->db->insert('assets', $data);
		return;
	}

	function update_record($data)
	{
		$this->db->where('id', 3);
		$this->db->update('assets', $data);
	}


	 function delete_row()
       {
	  	$this->db->where('id', $this->uri->segment(3));
	  	$this->db->delete('assets');

	   }


}

Open in new window


Here is my view:

Open in new window

0
I have attached files, i am trying to display results in a table, i am new to codeigniter is there a way to do this? what would be the best way to implement this? i have read about codeigniter tables but i am not sure how to apply to my code. Any guidance will be appreciated.
Thank You!
site.php
site_model.php
options_view.php
0
KuppingerCole Reviews AlgoSec in Executive Report
KuppingerCole Reviews AlgoSec in Executive Report

Leading analyst firm, KuppingerCole reviews AlgoSec's Security Policy Management Solution, and the security challenges faced by companies today in their Executive View report.

I am following the tutorial from here: "http://itsolutionstuff.com/post/codeigniter-3-and-angularjs-crud-with-search-and-pagination-exampleexample.html"

I am getting these errors: errors
Where am i going wrong ? i have tried exhaustively to search for answer or hint but i am lost, i am obviously pretty new to codeigniter.
Here is link to github files that i downloaded for tutorial. I appreciate any help or suggestion. Thank You all.
0
The problem I'm facing is in the pagination part, while searching using the restaurant name, it retrieves all the records but while moving to the next page of the pagination link the total row count is set to 0, although retrieving the data values from backend.

In the else part of my controller res_search(search controller) the search is being carried out for using the location options, and its working fine.

**res_search (CONTROLLER)**

   
 public function index()
	{
	    $where_clause = "status = 'Y' ";
        $search = ($this->input->get("resTitle"))? $this->input->get("resTitle") : "NIL";
        $search = ($this->uri->segment(3)) ? $this->uri->segment(3) : $search;


       if($this->input->get("resTitle")!="")
       {
        $total_row_res=  $this->common_model->res_count($search,"") ;
        $limit = 3;        

        $config['base_url'] = base_url()."res_search/index/$search";
        $config['total_rows'] =  $total_row_res;
        $config['per_page'] = $limit;
        $config["uri_segment"] = 4;
        $choice = $config["total_rows"]/$config["per_page"];
        $config["num_links"] = floor($choice);   
    
        $config['full_tag_open'] = '<ul class="pagination">';
        $config['full_tag_close'] = '</ul>';
        $config['first_link'] = false;
        $config['last_link'] = false;
        $config['first_tag_open'] = '<li>';
        $config['first_tag_close'] = '</li>';
        $config['prev_link'] = 'Prev';
        

Open in new window

0

CodeIgniter

35

Solutions

48

Contributors

Top Experts In
CodeIgniter
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!