title: Generate a random 10 digit number and insert into mysql?
body: <p>I am trying to generate a random 10 digit number and insert this into mysql on page load, so each time the page refreshes or loads there should be a different 10 digit number being inserted into the database, however at the moment it just keeps inserting the same 10 digit number again and again.</p>
  
  <p>Can someone please show me where I am going wrong? Thanks.</p>
  
  <pre><code>&lt;?php
      session_start();
      $db_hostname = 'localhost';
      $db_database = 'hewden1'; 
      $db_username = 'root';
      $db_password = '';
      $db_server = mysql_connect($db_hostname, $db_username, $db_password)    
              or die("Unable to connect to MySQL: " . mysql_error());
      mysql_select_db($db_database)   
      or die("Unable to select database: " . mysql_error());
  
      $num0 = (rand(10,100));
      $num1 = date("Ymd");
      $num2 = (rand(100,1000));
      $num3 = time();
      $randnum = $num0 . $num1 . $num2 . $num3;
  
  
      $sql="INSERT INTO supplier_session (session_number)
      VALUES ('$randnum')";
  
      $result = mysql_query($sql); 
      ?&gt;
  </code></pre>
  
  <p>This is the number I am constantly getting: 2147483647</p>