我有2个表,Cover
和Book
。
封面:
id number,
Case_name varchar(20)
(数据库表中的Case_name条目:好,坏,无)
图书:
id number,
Book_name varchar2(20),
Cover number
我有一本书的表格:
<div class="row-form" style="margin-top: -19px;">
<div class="span3" style="margin-top: 06px">Book_name:</div>
<div class="span9"><input type="text" name="bookname"/></div>
</div>
<div>
<select name='cstatus' style="width: 100%;">;
<?php
$user = "fyp";
$pass = "fyp";
$host = "localhost/CRMP";
// Connection with the Oracle.
$con = oci_connect($user, $pass, $host);
// Prepares an Oracle statement for execution.
$query = oci_parse($con,"SELECT id, Case_name FROM Cover");
// Executes a statement. oci_execute($query);
while($row = oci_fetch_array($query))
{
echo "<option value='".$row['id']."'>".$row['Case_name'].'</option>';
}
?>
</select>
</div>
我想获取所选名称的ID(好,坏,无),而不是我的数据库中的名称。像
Cover Table:
------------
id Case_name
1 good
2 bad
3 none
Book table:
----------
id booK_Name Cover
1 Alp 1(not the name "good")