要使用php插入数组的表中的动态值

时间:2016-12-08 07:05:48

标签: php mysql mysqli

<table>
    <thead>  
    <tr>
    <th>Agent Name</th>
    <th>Total Indent</th>
    <!--company name column header starts here-->
    <?php 
      $todaysdate= date('Y-m-d');
      $strSQL1 = "SELECT DISTINCT companyname FROM pamphletsbooking_tbl WHERE bookingdate='$todaysdate' AND pointname= '$pointname1' ORDER BY companyname ASC";
      $query1 = mysqli_query($db, $strSQL1);
      while ($result1 = mysqli_fetch_array($query1)){    
      $companyname1=$result1['companyname'];            
      echo "<th>";
      echo $companyname1;  
      echo "</th>";
      }     
    ?>
    <!--company name column header ends here-->    
    </tr>
    </thead>
    <tbody>
    <?php
    $strSQL ="SELECT * FROM paperagents_tbl WHERE pointshortname= '$pointname1' ORDER BY agentname ASC";
    $query = mysqli_query($db, $strSQL);
    $i=0; 
    $v="vendor";

     while($result = mysqli_fetch_array($query)) 
    {
      $a=$result["agentname"]."";
      $b=$result["Totalindent"]."";
      ?>
        <tr>
          <td><?=$a?></td> 
          <td><?=$b?></td>
          <?php 
            $todaysdate= date('Y-m-d');
            $strSQL1 = "SELECT DISTINCT companyname FROM pamphletsbooking_tbl WHERE bookingdate='$todaysdate' AND pointname= '$pointname1' ORDER BY companyname ASC";
            $query1 = mysqli_query($db, $strSQL1);
            while ($result1 = mysqli_fetch_array($query1)){    
          ?>
          <td><input type="number" tabindex="1" value="" name="<?=$v.$i?>"></td>[out put of this code][1]
          <?php   
            }     
          ?>
          </tr>         
          <?php
            $i++;
    }
    ?>
    </tbody>
    </table>

using this output i need to insert the data from the textbox   - 这里代理名称和公司名称如google yahoo是从数据库中动态获取的。   - 在谷歌下只有一个文本框,每个地方循环。   - 这里的问题是需要相应地插入数据,例如从文本框到数据库的代理。   - 最后每次代理和公司根据给定查询中的点名进行更改。

0 个答案:

没有答案