在这里,我必须#second_area在点击输入时隐藏div id .ID名称是 #employee_id
<form id="search_form" name="search_form" method="get" action="" >
<table width="98%" id="performance_tbl" align="center">
<div id="first_row">
<tr class="first_tr">
<th scope="row"><label for="employee_id">Employee ID: </label></th>
<td><input type="text" name="employee_id" id="employee_id" /></td>
</tr>
</div>
<tr>
<td> </td>
</tr>
<div id="second_area">
<tr>
<th scope="row"><label for="company_id">Company Name:</label></th>
<td><input type="text" name="company_id" id="company_id" /></td>
<th><label for="department_id">Department Name: </label></th>
<td><input type="text" name="department_id" id="department_id" /></td>
</tr>
<tr>
<th scope="row"><label for="current_year">Select Year: </label></th>
<td><input type="number" name="current_year" id="current_year" /></td>
<th><label for="compare_year">Compare Year: </label></th>
<td><input type="number" name="compare_year" id="compare_year" /></td>
</tr>
<tr>
<th …Run Code Online (Sandbox Code Playgroud) //this is my connection function. It is connecting databse successfully when I check.
$conn = connection($config['servername'],$config['username'],$config['password']);
Run Code Online (Sandbox Code Playgroud)
在此之后,我使用以下代码从数据库中获取数据
$id = 2;
if($conn) {
try {
$stmt = $conn->prepare('SELECT * FROM customer_tbl WHERE cus_id = :id');
$stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt->bindParam(':id', $id);
$results = $stmt->execute();
}catch (PDOException $e){
echo 'Error: ' . $e->getMessage();
}
}
Run Code Online (Sandbox Code Playgroud)
此代码在浏览器上显示以下错误消息
错误:SQLSTATE [IM001]:驱动程序不支持此功能:此驱动程序不支持设置属性
我的代码出了什么问题?为什么我无法从数据库中获取数据?
如果我想使用prepare语句从databese获取此指定数据如何编码?