我需要在特定的td中将多个sql查询插入一个表中。我怎么能这样做?我有这个查询,工作正常:
$sql = "SELECT Code, Name, Specification, Specification2, X_pozicane_u FROM StoreCards";
$stmt = sqlsrv_query( $conn, $sql );
并输出:
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo "<tr>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Specification'] . "</td>";
echo "<td>" . $row['Specification2'] . "</td>";
echo "<td>" . $row['X_pozicane_u'] . "</td>";
echo "</tr>";
如何设置sql2并将其插入特定的TD?
谢谢
答案 0 :(得分:-2)
试试这个:
<?php
$sql = "SELECT Code, Name, Specification, Specification2, X_pozicane_u FROM StoreCards";
$stmt = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Specification'] . "</td>";
echo "<td>" . $row['Specification2'] . "</td>";
echo "<td>" . $row['X_pozicane_u'] . "</td>";
echo "</tr>";
}
?>