SQL Query Pager

Dear everyone, I have developed this module where it retrieves all user messages from the database. The query looks like this: global $user; $messages_query = db_select(‘pm_message’, ‘i’) ->condition(‘i.recipient’, $user->uid ); $messages_query -> condition(‘i.deleted_from_inbox’, 0, ‘=’ ); $data = $query -> fields(‘i’, array ( ‘mid’ ));[…]

Exchanging variables across hook_form_validate and hook_form_submit

Dear everyone, I have a module with “mymodule_form_validate” and “mymodule_form_submit” functions. I have a “db_insert” function inside “mymodule_form_validate”. I retrieve the last SQL id number in “mymodule_form_validate” but I need to take it to “mymodule_form_submit function”. function mymodule_form_validate($form, &$form_state) { global $message_index; $message_index = db_insert(‘pm_index’)[…]