我正在创建一个搜索功能或流程以从数据库中进行选择并在 listdropbox 中显示数据,以选择 MySQL 数据库中已经存在的国家,但我遇到了一个错误,我不知道如何修复它任何人都可以帮助我我是 php 新手。错误是(警告:mysql_fetch_array() 期望参数 1 是资源,布尔值在 C:\wamp\www\Unnamed Site 2\resources\searchForm.php 第 36 行给出)
搜索.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search page</title>
<link href="style/stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.searchtitle {
text-align: center;
}
</style>
</head>
<body>
<!--<?php require_once('header.php'); ?>-->
<table width="80%" height="432">
<tr>
<td width="14%" valign="top"><!--<?php require_once('leftsideBar.php'); ?>-->
</td>
<td width="86%" valign="top"><h2 class="searchtitle">Search Types</h2>
<table width="95%" height="94">
<form action="searchProcess.php" method="post" id="searchForm">
<tr>
<td width="20%"><label for="searchByName2">By Name</label>
<select name="searchByName" id="searchByName2">
</select></td>
<td width="20%"><label for="searchByCountry">By Country</label>
<select name="searchByCountry" id="searchByCountry">
<option id="0">--select your country--</option>
<?php
require_once('Connections/connfor_lamelchameltest.php');
$getallCountries = mysql_query("SELECT * FROM country");
while($viewallCountries = mysql_fetch_array($getallCountries)){
?>
<option id="<?php echo $viewallCountries['country_id']; ?> "><?php echo $viewallCountries['country_name'] ?></option>
<?php } ?>
</select></td>
<td width="25%"><label for="searchByGovernorate">By Governorate</label>
<select name="searchByGovernorate" id="searchByGovernorate">
</select></td>
<td width="15%"><label for="searchByCity">By City</label>
<select name="searchByCity" id="searchByCity">
</select></td>
<td width="20%"><label for="searchBySpecialization">By Specialization</label>
<select name="searchBySpecialization" id="searchBySpecialization">
</select></td>
</tr>
</form>
</table>
</tr>
</table>
</body>
</html>
connfor_lamelchameltest.php
<?php
$hostname_conn = "localhost";
$database_conn = "lam_el_chamel_db";
$username_conn = "root";
$password_conn = ".....";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
我添加我的配置文件