Drupal responses "the website encountered an unexpected error.Please try again later" after running db_update statement in my custom module. I always do this without any error. Any suggestion pls!

function mobile_user_form_submit($form, $form_state){
    $status =$form_state['values']['status'];

    $id = $form_state['values']['hid'];
    drupal_set_message(t($id ." / ". $deposit." / ".$status));
    if($id != ""){
        ->fields(array('deposit' => $deposit, 'status' => $status, "updated" => date('Y-m-d H:i:s')))
        ->condition('id', $id)
    drupal_set_message(t('successfully saved.'));   

After comment db_update() statement, it is ok no error message show.

Thank you,

------ Solved -------

And I try to update manually that record in mysql, in the field "deposit" I got an error message "Please select a value not more than 127". I found myself I set wrong datatype in deposit field, I was willing to set Integer datatype but I was not awared what I had set I set tinyint. After chaning tinyint to integer, "the website encountered an unexpected error.Please try again later" also removed.


  • Check your watchdog and apache logs for a more useful error message.
    – rooby
    Jun 4, 2015 at 3:46
  • @rooby, thanks so I have install watchdog module, you said apache logs, I am not familiar with apache logs how can I find apache logs in window with xampp.
    Jun 4, 2015 at 3:50
  • See stackoverflow.com/questions/3719549/… - I would think that maybe there might also be a menu item in the tray icon for viewing PHP error but I could be wrong as I don't use it.
    – rooby
    Jun 4, 2015 at 3:56
  • since you solved the problem, please be sure to add that as an answer and accept it, so the question does not remain unanswered in the system
    – Geoff
    Jun 4, 2015 at 20:54

1 Answer 1


Once try to insert manually in mobile_users(phpmyadmin) table with same data. Then check for any errors, if not then check recent logs/apache error logs for more suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.