title: How to store content of text file in Database using PHP
body: <p>//output Start </p>
  
  <p>Output File:-05012015.txt  </p>
  
  <pre><code>  This is of my output of file which is the mapper file used for the verification But all below no are store in the database .That No Description  are as follow
  
  
              34012015000180001000631931058620000607262Y22122014 N                   
  
  
  Above All Digits- 34 :-Contant value
                    01201500018 :-record number 
                    0001000631931058620 :-Doc No
                    000607262 :-Product Code
                    Y :-status
                    22122014 :date format DD/MM/YYYY
                      :-one Blank Space
                    N :- Status
                      :-Remaining Blank Spaces
  
  Above Description of record which store different column in the database...
  
  //Output End
  </code></pre>
  
  <p><strong>when the text file display the contents that contents including all no,characters,blank spaces and other blank spaces of records ends in the file which store in the different column.</strong></p>
  
  <p>When I click on the Second Submit Button then store Data int Mysql Database.<br>
  I want to store all contents of text file including all no,characters,blank spaces and other blank spaces of records in the mysql database.</p>
  
  <p>PHP &amp; HTML Code:-</p>
  
  <pre><code>        Below is the my PHP with HTMl Code 
  
          &lt;html&gt;
          &lt;style&gt;
          span{color: #FF0000;}
          &lt;/style&gt;
          &lt;body&gt;
          &lt;script type="text/javascript"&gt;
          function validate()
          {
          if( document.myForm.photo.value == "" )
             {
               alert( "Please Upload File!" );
               document.myForm.photo.focus();
               return false;
             }
              return( true );
          }
          &lt;/script&gt;
          &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;" enctype="multipart/form-data" name="myForm" onsubmit="return(validate());"&gt;
          Attach Mapper File:-&lt;input type="file" name="photo" size="140"&gt; &lt;span&gt;[Select Only  .TXT fle]&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
           &lt;input type="submit" name="submit" value="Submit"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
          &lt;br &gt;&lt;br&gt; &lt;br&gt; 
  
          &lt;/form&gt;
  
          &lt;/body&gt;
          &lt;/html&gt;
  
          ===================================================================================================================================================
          &lt;b&gt;File Name:-&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php
          // escape variables for security
                $pic=( $_FILES['photo']['name']);
           echo basename($pic) . "&lt;br/&gt;";?&gt;&lt;br&gt; 
          File Description:-&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; 
  
          &lt;?php
  
          $file=fopen ("test/$pic","r") or exit("Error");
          $data="";
  
          while(!feof($file))
          {
  
            $data .= "&lt;pre&gt;" . fgets($file) . "&lt;br/&gt;";
          }
  
          fclose($file);
          echo $data;
  
          ?&gt;
          =====================================================================================================================================================================
          &lt;html&gt;
          &lt;body&gt;
           &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;
           &lt;input type="submit" name="submit2" value="Submit"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
          &lt;/form&gt;
          &lt;/body&gt;
          &lt;/html&gt;
  
  //Code End
  </code></pre>
  
  <p>Mysql Table Syntax:-</p>
  
  <pre><code>CREATE TABLE test(
  id int(5) NOT NULL AUTO_INCREMENT,
  no1 varchar(40)  NOT NULL,
  no2 varchar(40),
  no3 varchar(40),
  no4 varchar(40),
  no5 varchar(40),
  no6 varchar(40),
  no7 varchar(40),
  no8 varchar(40),
  no9 varchar(40),
  PRIMARY KEY (id))
  engine=InnoDB;
  </code></pre>