title: How to Import excel file by selecting id from another table for excel column
body: <p>I need to import csv into database using php .It is working .But I need to find id from another table for excel column and import it into database .
  My Import code</p>
  <pre><code>if ($_FILES[&quot;downtime&quot;][&quot;size&quot;] &gt; 0) {
       //  echo(&quot;&lt;script&gt;location.href = 'adhocadd.php';&lt;/script&gt;&quot;);
       $file = fopen($fileName, &quot;r&quot;);
      // fgetcsv($handle);
         fgetcsv($file, 10000, &quot;,&quot;);
        while (($row = fgetcsv($file, 10000, &quot;,&quot;)) !== FALSE) {
                  
                    $station_id=$row[0];
                    // $linename=$row[1];
                     $line=$row[1];
                     // $line=$lineid;
                    //  $getexcellinesmodel=getexcellines($mysql_connectionLinkLocal,$line);
                       //$lineid=array();
                     
                      $starttime=$row[2];
                      $endtime=$row[3];
                      $duration=$row[4];
                      $category=$row[5];
                      $reason=$row[6];
                      $detail=$row[7];
                      $comment=$row[8];
                      $action=$row[9];
                      $problempartnumber=$row[10];
                      $expectedpartnumber=$row[11];
                      $cartnumber=$row[12];
                       $reporter=$row[13];
                       $entrytype=$row[14];
                       $shift=$row[15];
                       $options=$row[16];
                       $updated_at=$row[17];
                         
                     
                       $importdowntime=importdowntime($mysql_connectionLinkLocal,$station_id,$line,$duration,$category,$reason,$detail,$comment,$action,$problempartnumber,$expectedpartnumber,$cartnumber,$reporter,$entrytype,$shift,$options,$updated_at,$starttime,$endtime);        
       
                  
        } 
        $success=&quot;downtime imported successfully &quot;; 
       echo(&quot;&lt;script&gt;location.href = 'upload.php?success=$success';&lt;/script&gt;&quot;);
             
  
     }
  </code></pre>
  <p>It is importing data into downtime table.
  $row<a href="https://i.stack.imgur.com/UVpAn.png" rel="nofollow noreferrer">1</a> contains linename .I need to find id of that linename from line table and import into the downtime table . <a href="https://i.stack.imgur.com/UVpAn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UVpAn.png" alt="" /></a></p>