我正在尝试使用列CUST_BULSTAT
中的值创建一个搜索表单(最好是使用下拉菜单),并获取将打印到文本模板文档中的单行数据。
在这个阶段,我连接到数据库并获取一些数据。但这应该通过搜索表单来完成
我的代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form action="" method="post">
<input type="text" name="search" /><br />
<input type="submit" value="Submit" />
</form>
<?php
$host = 'localhost:C:\Program Files (x86)\Firebird\Firebird_2_5\bin\Service.gdb';
$username = 'SYSDBA';
$password = 'masterkey';
$dbh = ibase_connect("localhost:C:\Program Files (x86)\Firebird\Firebird_2_5\bin\Service.gdb","SYSDBA", "masterkey", "UTF-8") or die('die message');
$search = s($_REQUEST['search']);
$q = ibase_query($dbh, "select * from CUSTOMERS WHERE CUST_BULSTAT LIKE '%".$search."%'");
while ($row = ibase_fetch_object($q)) {
echo $row->CUST_BULSTAT, "<br>";
echo $row->CUST_MANAGERNAME, "<br>";
echo $row->CUST_TOWN, "<br>";
echo $row->CUST_STREET, "<br>";
}
ibase_free_result($q);
ibase_close($dbh);
?>
</body>
</html>
最好的问候Valentin
我的问题是如何使用下拉列表创建一个搜索表单,其中列出了CUSTOMERS表CUST_BULSTAT列中的值,并检查其中一个从数据库中提取CUST_BULSTAT与我在中选择的数据相同的整行数据下拉菜单。
希望现在更清楚
最好的问候Valentin