Q:

I want to escape the limit() in db_select

I want to delete the limit() from my code: 
$query = db_select('watchdog', 'wa')
    -> extend('PagerDefault')
    -> orderBy('wid')
    -> fields('wa', array('variables', 'type', 'severity',
      'message', 'wid', 'timestamp'))
    -> limit(2000);
  $result = $query -> execute();

and I want the user to select from a form the number to select. How I can do this thing?

A:

See this example:
    <?php

    if(!empty($_POST['number'])) {
      $number = $_POST['number'];

    /*
    Add your code here
    */

    $query = db_select('watchdog', 'wa')
        -> extend('PagerDefault')
        -> orderBy('wid')
        -> fields('wa', array('variables', 'type', 'severity',
          'message', 'wid', 'timestamp'))
        -> limit($number);
      $result = $query -> execute();

}

    <form action='' method='POST'>
    <input type=text value='' name='number'>
    <input type=submit value='send'>
    </form>

