Welcome Guest, Not a member yet? Register   Sign In
check exist value coincidence
#1

[eluser]Gabi3xz[/eluser]
I have a code for check exist a category in datebase
Code:
$result_cat = $this->call_db->category_check($this->input->post('cat_name'));
if ( $result_cat != false ) {
        echo 'Category not exist';
}
Works good but example
I go to a page for edit category, value category should always be another value because their finds value in the database and forced me to change the value category.
Iow do I solve?
#2

[eluser]Glazz[/eluser]
Can you explain, better, what is wrong with your code ?

#3

[eluser]Gabi3xz[/eluser]
Code is not wrong, problem is I want to edit an existing value and this code check the current value in datebase and I say that exist and forced me to change it
#4

[eluser]Glazz[/eluser]
Hmm i still don't understand very well, your english is not the best..

You should update a row on the database using his unique id.

Something like this:
Code:
$params = array(
   'cat_name' => $this->input->post('cat_name')
);
$this->db->where('cat_id', $your_cat_id_here)->update('categories_table_name', $params);

Where you have $your_cat_id_here it is the category unique id on the database.
#5

[eluser]Gabi3xz[/eluser]
look here
http://img69.imageshack.us/img69/7153/dadsasd.jpg




Theme © iAndrew 2016 - Forum software by © MyBB