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"; Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/ 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374500 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374648 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374649 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374656 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374747 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. Link to comment https://forums.phpfreaks.com/topic/267843-trying-to-insert-values-according-to-select-values/#findComment-1374783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.