CodeIgniter Forums

Full Version: Trying to extend the input class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]douglasbrownca01[/eluser]
I am trying to store a query string in a table then bring it back the string and substitue the the id number to shorten the url.

I've done this for the MY_Input.php in the library.


<?php
class MY_Input extends CI_Input {


function save_query($query_array) {

$CI =& get_instance();

$CI->db->insert('ci_query', array('query_string' => http_build_query($query_array)));

return $CI->db->insert_id();
}

function load_query($query_id) {

$CI =& get_instance();

$rows = $CI->db->get_where('ci_query', array('id' => $query_id))->result();
if (isset($rows[0])) {
parse_str($rows[0]->query_string, $_GET);
}

}

}


in my search function in the controler I save the query string like this:


$query_id = $this->input->save_query($query_array);

All I get is a blank screen, not a 404 error -- So something is failing somewhere. I know that the function is being reconized -- when I remove the code from MY_Input.php, I get an error, so I know that it's registering.

What is the best way to trouble shoot something like this when you're getting a blank screen?

El Forum

[eluser]Rowan Wilson[/eluser]
A good start is to set:

Code:
$config['log_threshold'] = 4;

In your application/config/config.php.

Then have a look in application/logs directory. Remember to set it back to 0 (or 1 if you prefer during dev stage) otherwise the files soon get very big.

El Forum

[eluser]InsiteFX[/eluser]
Your missing the constructor part.
Code:
public function __construct()
{
    parent::__construct();
}

El Forum

[eluser]douglasbrownca01[/eluser]
Thank you very much for your reponse. I really appreciate it.
It didn't seem to help. As I understand you, I needed to add the public contructor to the MY_Input.php file....which I did.

Still getting a blank screen, and the log says there is php error over the date, but I'm not using the date function in the controller.


In my search function in the controller --


public function search() {


$query_array = array(
'fan_type_options'=>$this->input->post('fan_type_options'),
'fan_motor_type' => $this->input->post('fan_motor_type'),
'fan_ac_voltage' => $this->input->post('fan_ac_voltage'),
'fan_cfm' => $this->input->post('fan_cfm'),
'part-no' => $this->input->post('part-no'),
);

//print_r($query_array);


$query_id = $this->input->save_query($query_array);

redirect("rosenberg/view/$query_id");

}


if I print the $query_array -- it shows up correctly from the form post, so I know it's got data to insert into the table.

El Forum

[eluser]douglasbrownca01[/eluser]
Thank you very much for your reponse. I really appreciate it.
It didn't seem to help. As I understand you, I needed to add the public contructor to the MY_Input.php file....which I did.

Still getting a blank screen, and the log says there is php error over the date, but I'm not using the date function in the controller.


In my search function in the controller --


public function search() {


$query_array = array(
'fan_type_options'=>$this->input->post('fan_type_options'),
'fan_motor_type' => $this->input->post('fan_motor_type'),
'fan_ac_voltage' => $this->input->post('fan_ac_voltage'),
'fan_cfm' => $this->input->post('fan_cfm'),
'part-no' => $this->input->post('part-no'),
);

//print_r($query_array);


$query_id = $this->input->save_query($query_array);

redirect("rosenberg/view/$query_id");

}


if I print the $query_array -- it shows up correctly from the form post, so I know it's got data to insert into the table.

El Forum

[eluser]Rowan Wilson[/eluser]
How about posting a snip of your log or if it's large, uploading it somewhere?

El Forum

[eluser]douglasbrownca01[/eluser]
Thanks, here's a url where you can grab it. txt files are apparently off limits as attachments. http://www.visualgrammar.com/dev/ci_issue.php

El Forum

[eluser]CroNiX[/eluser]
Those timezone warnings are from php 5.3x. To get rid of them, either put the timezone in php.ini, or at the top of your index.php file, put:
Code:
date_default_timezone_set('America/Los_Angeles');
with your correct timezone.

El Forum

[eluser]CroNiX[/eluser]
Where did you put your MY_Input.php file? It should be in /application/core if it isn't.

El Forum

[eluser]CroNiX[/eluser]
and please use code tags when posting code Smile
Pages: 1 2