The following code is straight from the docs and should insert a row into the "test" table.
$row = &JTable::getInstance('test', 'Table');
if (!$row->bind( array('user_id'=>123, 'customer_id'=>1234) )) {
return JError::raiseWarning( 500, $row->getError() );
}
if (!$row->store()) {
JError::raiseError(500, $row->getError() );
}
My table class looks like this:
class TableTest extends JTable
{
var $user_id = null;
var $customer_id = null;
function __construct(&$db)
{
parent::__construct( '#__ipwatch', 'user_id', $db );
}
}
SELECT queries work fine, but not INSERT ones. Through debugging I find that the query being executed is UPDATE jos_test SET customer_id='1234' WHERE user_id='123', which fails because the row doesn't exist yet in the database (should INSERT instead of UPDATE).
While digging through the Joomla code I find this:
function __construct( $table, $key, &$db )
{
$this->_tbl = $table;
$this->_tbl_key = $key;
$this->_db =& $db;
}
.....
.....
function store( $updateNulls=false )
{
$k = $this->_tbl_key;
if( $this->$k)
{
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
}
else
{
$ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key );
}
if( !$ret )
{
$this->setError(get_class( $this ).'::store failed - '.$this->_db->getErrorMsg());
return false;
}
else
{
return true;
}
}
_tbl_key here is "user_id" that I passed in my TableTest class, so it would appear that it will always call updateObject() when this key is set. Which is baffling.
Anyone have any insight?
function store( $updateNulls=false )
{
// You set user_id so this branch is executed
if( $this->$k)
{
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
}
// ...
Looking at the code it seems to me that store() check if the primary key field is present and if it use updateObject(). This means if you want to store a new user you can't specify the user_id.
Related
For checkout I use one script to show and hide billing fields depending on the shipping way.
Earlier it worked fine, but that time - I think because of using select2 in the city field instead of the text input - the address text field is making issues.
When user writes their address not so fast, the form is starting to update too quick, can delete the new written after that short pause characters or not delete, randomly, and when I want to delete something - the select 2 can appear on the top of the page and not closing.
add_filter( 'woocommerce_update_order_review_fragments', 'awoohc_add_update_form_billing', 99 );
function awoohc_add_update_form_billing( $fragments ) {
$checkout = WC()->checkout();
ob_start();
?>
<div class="woocommerce-billing-fields__field-wrapper">
<?php
$fields = $checkout->get_checkout_fields( 'billing' );
foreach ( $fields as $key => $field ) {
if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) {
$field['country'] = $checkout->get_value( $field['country_field'] );
}
woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
}
?>
</div>
<?php
$art_add_update_form_billing = ob_get_clean();
$fragments['.woocommerce-billing-fields'] = $art_add_update_form_billing;
return $fragments;
}
add_filter( 'woocommerce_checkout_fields' , 'override_billing_checkout_fields', 20, 1 );
function override_billing_checkout_fields( $fields ) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
if ( 'local_pickup:1' === $chosen_methods[0] ) {
unset( $fields['billing']['billing_address_1'] );
unset( $fields['billing']['billing_city'] );
unset( $fields['billing']['billing_state'] );
}
return $fields;
}
add_filter( 'woocommerce_checkout_fields' , 'b_override_billing_checkout_fields', 20, 1 );
function b_override_billing_checkout_fields( $fields ) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
if ( 'boxberry_self:4' === $chosen_methods[0] || 'boxberry_self_after:6' === $chosen_methods[0] ) {
unset( $fields['billing']['billing_address_1'] );
}
return $fields;
}
// Just hide woocommerce billing country
add_action( 'woocommerce_before_checkout_form', 'hide_checkout_billing_country', 5 );
function hide_checkout_billing_country() {
echo '<style>#billing_country_field{display:none;}</style>';
}
add_filter('woocommerce_billing_fields', 'customize_checkout_fields', 100 );
function customize_checkout_fields( $fields ) {
if ( is_checkout() ) {
// HERE set the required key fields below
$chosen_fields = array( 'postcode', 'country', 'company','last_name', 'address_2');
foreach( $chosen_fields as $key ) {
if( isset($fields['billing_'.$key]) && $key !== 'country') {
unset($fields['billing_'.$key]); // Remove all define fields except country
}
}
}
return $fields;
}
/*
* Updating the form
*/
add_action( 'wp_footer', 'awoohc_add_script_update_shipping_method' );
function awoohc_add_script_update_shipping_method() {
if ( is_checkout() ) {
?>
<script>
jQuery(document).ready(function ($) {
$(document.body).on('updated_checkout updated_shipping_method', function (event, xhr, data) {
$('input[name^="shipping_method"]').on('change', function () {
$('.woocommerce-billing-fields__field-wrapper').block({
message: null,
overlayCSS: {
background: '#fff',
'z-index': 1000000,
opacity: 0.3
}
});
$('select#billing_city').select2();
});
var first_name = $('#billing_first_name').val(),
phone = $('#billing_phone').val(),
email = $('#billing_email').val(),
city = $('#billing_city').val(),
address_1 = $('#billing_address_1').val(),
$(".woocommerce-billing-fields__field-wrapper").html(xhr.fragments[".woocommerce-billing-fields"]);
$(".woocommerce-billing-fields__field-wrapper").find('input[name="billing_first_name"]').val(first_name);
$(".woocommerce-billing-fields__field-wrapper").find('input[name="billing_phone"]').val(phone);
$(".woocommerce-billing-fields__field-wrapper").find('input[name="billing_email"]').val(email);
$(".woocommerce-billing-fields__field-wrapper").find('input[name="billing_city"]').val(city);
$('select#billing_city').select2();
$(".woocommerce-billing-fields__field-wrapper").find('input[name="billing_address_1"]').val(address_1);
$('.woocommerce-billing-fields__field-wrapper').unblock();
});
});
</script>
<?php
}
}
Yes, I needed to use select2 twice, in other ways it didn't work as needed. But when even I use it once, it didn't help me with that issue. I can't disable select2, the client needs it, and needs to fix changing the address.
How I replaced the city input to select
add_filter( 'woocommerce_checkout_fields' , 'override_checkout_city_fields' );
function override_checkout_city_fields( $fields ) {
// Define here in the array your desired cities (Here an example of cities)
$option_cities = array(
'city1' => 'city1',
'city2' => 'city2',
);
$fields['billing']['billing_city']['type'] = 'select';
$fields['billing']['billing_city']['options'] = $option_cities;
$fields['shipping']['shipping_city']['type'] = 'select';
$fields['shipping']['shipping_city']['options'] = $option_cities;
return $fields;
}
Or maybe it's a delivery service plugin. Maybe you see what I don't see.
I know that exist many plugins, but I need to find what's wrong manually.
I tried to /comment/ different parts of the script, so I think it's something with select, or with delicery service plugin if not it.
i am getting error Call to a member function row() on a non-object in codeigniter my controller is
public function edit_survey_pro($id)
{
$id = intval($id);
$survey = $this->model->get("surveys",array("ID" => $id),100000);
if (sizeof($survey) == 0) $this->template->error(lang("error_32"));
$this->template->loadContent("user/edit_survey_pro", array(
"survey" => $survey->row()
)
);
}
my model is
function get($table,$where='',$perpage=0,$start=0,$order_by='',$arr='')
{
$this->db->from($table);
if($perpage != 0 && $perpage != NULL)
$this->db->limit($perpage,$start);
if($where){
$this->db->where($where);
}
if($order_by){
$this->db->order_by($order_by);
}
if($arr=='')
$query = $this->db->get()->result();
else
$query = $this->db->get()->result('array');
if(!empty($query))
if($perpage != 0 && $perpage != NULL)
$result = $query;
else
$result = $query[0];
else
$result = array();
return $result;
}
here loadContent() is just load the content with view path
public function loadContent($view,$data=array(),$die=0){
//something to load the content
}
in my model I am getting the result as an array of object in $query and then it is returned as $result like this -
$query = $this->db->get()->result(); but at the controller $survey stores array of object and i want to show the content of that array of object ,previously I use
$this->template->loadContent("user/edit_survey_pro", array(
"survey" => $survey->row()
)
);
to get that data but the problem is $survey->row() cannot return that data bcoz it is not an object it is array of object so it can't be returned through row() method
so instead of this I just call the first element of that data like this-
$this->template->loadContent("user/edit_survey_pro", array(
"survey" => $survey[0]
)
);
Somehow its works for me bcoz I want to show the first row of the data
if sembody wants to show all data then I think he shuld try logic to increment the key value of that array of object for me it is $survey[] you can use foreach loop for increment the of value of the key element
The problems i see are your model, I will dissect it and add comments to your original code to point out the issues:
function get($table,$where='',$perpage=0,$start=0,$order_by='',$arr='')
//above there are problems, you are setting some of your parameters to
//equal blank, but below, in your conditionals, you are checking if they
// exist. They will always exist if they are set to blank. Fix them by
// setting them = NULL like this:
// get($table,$where=null,$perpage=0,$start=0,$order_by=null,$arr=null)
{
$this->db->select();// <-- you forgot this
$this->db->from($table);
if($perpage != 0 && $perpage != NULL)
//when will $perpage = null? , if never, then you dont need it.
$this->db->limit($perpage,$start);
if($where){
//change this to if(isset($where)). Also why do you use
//curly braces here, but not in the above if statement if only
//one line is affected in your if. I would remove the
//curly braces here.
$this->db->where($where);
}
if($order_by){
// change this to if(isset($order_by)). Same thing as
//above about the curly braces here
$this->db->order_by($order_by);
}
if($arr=='')
// change this to if(isset($arr)).
$query = $this->db->get()->result();
else
$query = $this->db->get()->result('array');
//change this to: $query = $this->db->get()->result_array();
if(!empty($query))
//change the above to if($query->num_rows > 0). Also, here since
//your code body is longer then one line, you will need curly braces
//around your if statement
if($perpage != 0 && $perpage != NULL)
//again, will $perpage ever be NULL? However, why do you need
//this conditional at all, if the limit above is already
//doing this job?
$result = $query;
else
$result = $query[0];
else
$result = array();
return $result;
}
after applying all the changes:
MODEL:
function get($table, $where=null, $perpage=0, $start=0, $order_by=null, $arr=null)
{
$this->db->select();
$this->db->from($table);
if($perpage != 0)
$this->db->limit($perpage, $start);
if(isset($where))
$this->db->where($where);
if(isset($order_by))
$this->db->order_by($order_by);
if(isset($arr)) {
$result = $this->db->get()->result_array();
} else {
$result = $this->db->get()->result();
}
return $result;
}
CONTROLLER
public function edit_survey_pro($id) {
$id = intval($id);
$survey = $this->model->get("surveys",array("ID" => $id),100000);
if (!$survey) {
$this->template->error(lang("error_32"));
} else {
$data["survey"] = $survey;
$this->template->loadContent("user/edit_survey_pro", $data);
}
}
I think when you use $this->db->get(), you need to pass the table name as param like this:
$this->db->get('table_name')->result();
I need to compare two values in a table: cliente and nro_cuota, if both exist I don't want to add it.
Here is my code
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('cobranzas');
$crud->set_subject('Cobranzas');
$crud->set_language('spanish');
$crud->required_fields(
'id',
'cobrador',
'cliente',
'nro_cuota'
);
$crud->columns(
'cobrador',
'cliente',
'nro_cuota'
);
$crud->set_relation('cobrador', 'cobradores', 'apellido_nombre');
$crud->set_relation('cliente', 'clientes', 'apellido_nombre');
$output = $crud->render();
$this->load->view('cobranzas/cobranzas_v', $output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}
and I wrote a model, I`m not sure if this is the right way, but I don't know how I must call it
class Compare_values_model extends CI_Model
{
public function compare($id)
{
$this->db->select('"SELECT * FROM `cobranzas` WHERE `cliente` = '$cliente' AND `nro_cuota` = '$nro_cuota'"');
if ($query->num_rows() > 0) {
return true;
} else {
return false;
}
}
}
Hope can help me I couldn't find some examples on internet to learn more, thanks in advance.
You said I need to compare two values in a table: cliente and nro_cuota, if both exist I don't want to add it. But you are matching the variables with fields. So just check not equal as below:
$query = $this->db->query("SELECT * FROM `cobranzas` WHERE `cliente` <> '$cliente' AND `nro_cuota` <> '$nro_cuota'");
Note: Remove extra single quote in your query
How can we override the error message to be displayed, multiple times for a single validation rule.
I am trying to do that in the following code, but it shows the error message which is set at the end, i.e., 'b'
What I have tried to do here is, display error 'a' for 'first_name' and error 'b' for last_name.
<?php
/*
This program will test whether we could override the codeingiter error messages from the validation helper.
We are going to use the 'set_message' function.
*/
class Message_override extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->helper('url');
}
public function index(){
$this->load->view('message_override_view');
}
public function display_error(){
$this->load->library('form_validation');
$this->form_validation->set_message('numeric','a');
$this->form_validation->set_rules('txt_first_name', 'First Name', 'numeric');
$this->form_validation->set_message('numeric','b');
$this->form_validation->set_rules('txt_last_name', 'Last Name', 'numeric');
if($this->form_validation->run()==FALSE)
{
print_r(validation_errors());
}
else
{
echo '<pre>';
print_r($_POST);
}
}
}
?>
CodeIgniter doesn't support multiple error messages for the same rule natively, but there's a couple of workarounds you may try:
As #HashemQolami suggests, you can use multiple callback functions and set a different error message for each one:
$this->form_validation->set_rules('txt_first_name', 'First Name', 'callback_numeric_a');
$this->form_validation->set_rules('txt_last_name', 'Last Name', 'callback_numeric_b');
The drawback for this method is that obviously it's not modular but rather repetitive as you'd need to define multiple functions in your controller like this one
public function numeric_a($str){
$this->form_validation->set_message('numeric_a', 'a');
return $this->numeric($str);
}
Another workaround I've used is set the message of the rule as %s in the language file and then setting the custom message as the label of the field
$lang['numeric'] = '%s';
$this->form_validation->set_rules('txt_first_name', 'a', 'numeric');
$this->form_validation->set_rules('txt_last_name', 'b', 'numeric');
The drawback here is that it basically messes up the error messaging system since you'd have to define the label for each field and would only work correctly with one validation rule per field. Still I have found it useful in contact forms where you basically just need to validate the presence of some required fields.
Now since I've found myself in need for a better implementation for this feature, your post inspired me to put together a simple extension to the form validation class, unfortunately I had to "hack" the main execute method since there's no special function for retrieving the error messages.
I added a method set_custom_message() to set a custom message for a rule to a specific field or to an array of fields.
$this->form_validation->set_custom_message('txt_first_name','numeric','a');
$this->form_validation->set_custom_message('txt_last_name','numeric','b');
//Example passing an array of fields
$this->form_validation->set_custom_message(array('txt_first_name','txt_last_name'),'numeric','c');
Here's the code for the extended class in case someone else is interested:
Note that this is based on the form validation class included in CodeIgniter v2.1.4
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* MY_Form_validation Class
*
* Extends Form_Validation library
*
* Adds custom message support.
*
*/
class MY_Form_validation extends CI_Form_validation {
protected $_custom_messages = array();
public function set_custom_message($field = '', $rule = '', $message = '' ){
if(is_array($field)){
foreach($field as $id){
$this->_custom_messages[$id][$rule] = $message;
}
return;
}
$this->_custom_messages[$field][$rule] = $message;
return;
}
protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
{
// If the $_POST data is an array we will run a recursive call
if (is_array($postdata))
{
foreach ($postdata as $key => $val)
{
$this->_execute($row, $rules, $val, $cycles);
$cycles++;
}
return;
}
// --------------------------------------------------------------------
// If the field is blank, but NOT required, no further tests are necessary
$callback = FALSE;
if ( ! in_array('required', $rules) AND is_null($postdata))
{
// Before we bail out, does the rule contain a callback?
if (preg_match("/(callback_\w+(\[.*?\])?)/", implode(' ', $rules), $match))
{
$callback = TRUE;
$rules = (array('1' => $match[1]));
}
else
{
return;
}
}
// --------------------------------------------------------------------
// Isset Test. Typically this rule will only apply to checkboxes.
if (is_null($postdata) AND $callback == FALSE)
{
if (in_array('isset', $rules, TRUE) OR in_array('required', $rules))
{
// Set the message type
$type = (in_array('required', $rules)) ? 'required' : 'isset';
if(array_key_exists($row['field'],$this->_custom_messages) &&
array_key_exists($type,$this->_custom_messages[$row['field']])){
$line = $this->_custom_messages[$row['field']][$type];
}else{
if ( ! isset($this->_error_messages[$type]))
{
if (FALSE === ($line = $this->CI->lang->line($type)))
{
$line = 'The field was not set';
}
}
else
{
$line = $this->_error_messages[$type];
}
}
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']));
// Save the error message
$this->_field_data[$row['field']]['error'] = $message;
if ( ! isset($this->_error_array[$row['field']]))
{
$this->_error_array[$row['field']] = $message;
}
}
return;
}
// --------------------------------------------------------------------
// Cycle through each rule and run it
foreach ($rules As $rule)
{
$_in_array = FALSE;
// We set the $postdata variable with the current data in our master array so that
// each cycle of the loop is dealing with the processed data from the last cycle
if ($row['is_array'] == TRUE AND is_array($this->_field_data[$row['field']]['postdata']))
{
// We shouldn't need this safety, but just in case there isn't an array index
// associated with this cycle we'll bail out
if ( ! isset($this->_field_data[$row['field']]['postdata'][$cycles]))
{
continue;
}
$postdata = $this->_field_data[$row['field']]['postdata'][$cycles];
$_in_array = TRUE;
}
else
{
$postdata = $this->_field_data[$row['field']]['postdata'];
}
// --------------------------------------------------------------------
// Is the rule a callback?
$callback = FALSE;
if (substr($rule, 0, 9) == 'callback_')
{
$rule = substr($rule, 9);
$callback = TRUE;
}
// Strip the parameter (if exists) from the rule
// Rules can contain a parameter: max_length[5]
$param = FALSE;
if (preg_match("/(.*?)\[(.*)\]/", $rule, $match))
{
$rule = $match[1];
$param = $match[2];
}
// Call the function that corresponds to the rule
if ($callback === TRUE)
{
if ( ! method_exists($this->CI, $rule))
{
continue;
}
// Run the function and grab the result
$result = $this->CI->$rule($postdata, $param);
// Re-assign the result to the master data array
if ($_in_array == TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
// If the field isn't required and we just processed a callback we'll move on...
if ( ! in_array('required', $rules, TRUE) AND $result !== FALSE)
{
continue;
}
}
else
{
if ( ! method_exists($this, $rule))
{
// If our own wrapper function doesn't exist we see if a native PHP function does.
// Users can use any native PHP function call that has one param.
if (function_exists($rule))
{
$result = $rule($postdata);
if ($_in_array == TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
}
else
{
log_message('debug', "Unable to find validation rule: ".$rule);
}
continue;
}
$result = $this->$rule($postdata, $param);
if ($_in_array == TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
}
// Did the rule test negatively? If so, grab the error.
if ($result === FALSE)
{
if(array_key_exists($row['field'],$this->_custom_messages) &&
array_key_exists($rule,$this->_custom_messages[$row['field']])){
$line = $this->_custom_messages[$row['field']][$rule];
}else{
if ( ! isset($this->_error_messages[$rule]))
{
if (FALSE === ($line = $this->CI->lang->line($rule)))
{
$line = 'Unable to access an error message corresponding to your field name.';
}
}
else
{
$line = $this->_error_messages[$rule];
}
}
// Is the parameter we are inserting into the error message the name
// of another field? If so we need to grab its "field label"
if (isset($this->_field_data[$param]) AND isset($this->_field_data[$param]['label']))
{
$param = $this->_translate_fieldname($this->_field_data[$param]['label']);
}
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
// Save the error message
$this->_field_data[$row['field']]['error'] = $message;
if ( ! isset($this->_error_array[$row['field']]))
{
$this->_error_array[$row['field']] = $message;
}
return;
}
}
}
// END MY Form Validation Class
/* End of file MY_Form_validation.php */
/* Location: ./application/libraries/MY_Form_validation.php */
}
I'm writing a custom component for my work. I'm using hello component for building it. When I edit a form and save it I get this error:
Call to a member function bind() on a non-object
My code:
function save()
{
global $option;
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_abc'.DS.'tables');
$row =& JTable::getInstance('abc', 'Table');
if(!$row->bind(JRequest::get('post')))
{
JError::raiseError(500, $row->getError() );
}
$row->message = JRequest::getVar( 'message', '','post', 'string', JREQUEST_ALLOWRAW );
if(!$row->store()){
JError::raiseError(500, $row->getError() );
}
switch($this->_task)
{
case 'apply':
$msg = 'Change Saved';
$link = 'index.php?option='.$option.'&task=edit&cid[]='.$row->id;
break;
case 'save':
$msg = 'Saved';
$link = 'index.php?option='.$option;
break;
default:
}
$this->setRedirect($link, $msg);
}
The problem is that it's unable to create an instance.
Please let me know if anyone knows a solution.
Thanks.
The problem is you calling the method 'bind' that doesn't exists on the variable $row.
You defined $row as: $row =& JTable::getInstance('abc', 'Table'); which means your problem starts right there. It's trying to fetch database content which fails. I suggest you change the parameters 'abc' and 'Table' to something real, it looks like sample data to me.
The following code will help you:
function addComment($option)
{
global $mainframe;
$row =& JTable::getInstance( 'comment' , 'Table' );
if (!$row->bind(JRequest::get( 'post')))
{
JError::raiseError(500, $row->getError() );
}
$row->comment_date = date ( 'Y-m-d H:i:s' );
$user =& JFactory::getUser();
if($user->id)
{
$row->user_id = $user->id;
}
if(!$row->store())
{
JError::raiseError(500, $row->getError() );
}
$link = JRoute::_( 'index.php?option='.$option.'&id='.$row->id . '&task=view' );
$mainframe->redirect( $link, 'Comment Added' );
}
My table name data to be fetched is jos_abc. The save function is in my_componet/controller.php. The class name of controller is XyzController:
class XyzController extends JController {
function __construct() {
//Get View
if(JRequest::getCmd('view') == '') {
JRequest::setVar('view', 'default');
}
$this->item_type = 'Default';
parent::__construct();
}
function save()
{
global $option;
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_tripplanner'.DS.'tables');
$row1 =& JTable::getInstance('xyz', 'jos_abc');
if(!$row1->bind(JRequest::get('post')))
{
JError::raiseError(500, $row->getError() );
}
$row->message = JRequest::getVar( 'message', '','post', 'string', JREQUEST_ALLOWRAW );
if(!$row->store()){
JError::raiseError(500, $row->getError() );
}
switch($this->_task)
{
case 'apply':
$msg = 'Change Saved';
$link = 'index.php?option='.$option.'&task=edit&cid[]='.$row->id;
break;
case 'save':
$msg = 'Saved';
$link = 'index.php?option='.$option;
break;
default:
}
$this->setRedirect($link, $msg);
}
}
Even then I'm unable to save, I get "Call to a member function bind() on a non-object".