在php代码中用选项写HTML select

时间:2019-07-15 04:34:33

标签: php html oracle

我在html页面中有此php代码,如何从回显中使用...。

$stid = oci_parse($conn, "select user_id, username,user_job from users");
    oci_execute($stid);

    while (($row = oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS))!= false){

        echo $row['user_id'] . " " . $row['username'] .$row['user_job'] . "<br>\n";
   }

1 个答案:

答案 0 :(得分:1)

您可以执行以下操作:

$stid = oci_parse($conn, "select user_id, username,user_job from users");
oci_execute($stid);

echo "<select>";
while (($row = oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS))!= false){

    echo "<option value=$row[user_id]>". $row['username'] .$row['user_job'] . "</option>";
}
echo "</select>";