narjis Posted August 31, 2012 Share Posted August 31, 2012 I have a table having enum values and now i'm trying to insert and update the values according to the select values. It is not updating . Is is possible to update the values according to the form selection. Here is my code: <select name="task_type" id="task_type" class="chzn-select" style="width:250px"> <option value="0">Select Task Type</option> <option value="1">Controlled</option> <option value="2">Simple</option> <option value="3">With Notification</option> <option value="4">Collabration</option> <option value="5">Periodically</option> <option value="6">Once</option> <option value="7">Note</option> </select> and Here is the way I'm updating in the database; $table = user_tasks; $data = array( 'portal_id' => $portal_id, 'company_id' => $company_id, 'user_id' => $user_id, 'parent_id' => intval($_POST['parent_id']), 'assigned_to' => sanitize($_POST['assigned_to']), 'title' => sanitize($_POST['title']), 'task_type' => sanitize($_POST['task_type']), 'description' => sanitize($_POST['description']), 'status' => sanitize($_POST['status']), 'file_name'=> sanitize($_FILES['file_name']['name']), 'task_end_date' => sanitize($_POST['timetask']), 'repeat' => sanitize($_POST['repitition']), 'date_updated' => date('Y-m-d H:i:s') ); ($this->id) ? $db->update($table, $data, "id='" . (int)$this->id . "'") : $db->insert($table, $data); $message = ($this->id) ? "Task Updated Successfully" : "Task Added Successfully"; Quote Link to comment Share on other sites More sharing options...
fenway Posted September 1, 2012 Share Posted September 1, 2012 Again, we're not going to debug your code for you -- show us an INSERT statement. Quote Link to comment Share on other sites More sharing options...
narjis Posted September 2, 2012 Author Share Posted September 2, 2012 Ok sorry for asking such a question. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 2, 2012 Share Posted September 2, 2012 Ok sorry for asking such a question. We're happy to help -- but you've only provided some PHP code -- I can't possibly guess what that's doing. Quote Link to comment Share on other sites More sharing options...
narjis Posted September 2, 2012 Author Share Posted September 2, 2012 Actually I didn't understand they way enum column can be updated now I've found the solution that enum values are stored in the form of index starting from 1. they can be updated in the very same manner. Thanx anyway. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 2, 2012 Share Posted September 2, 2012 Actually I didn't understand they way enum column can be updated now I've found the solution that enum values are stored in the form of index starting from 1. they can be updated in the very same manner. Thanx anyway. The fact that it's an ENUM has absolutely no bearing on updating the values. Quote Link to comment Share on other sites More sharing options...
narjis Posted September 3, 2012 Author Share Posted September 3, 2012 Really!!! I just updated the column values after selecting from a drop down box. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.