我必须在PHP中使用localhost创建一个离线电影网站。不知何故,我无法获得正确的搜索,如果有人能向我解释原因,我会很高兴。搜索应该通过标题,年份,导演类型中的单词进行搜索。不要介意CSS只是希望它现在可以工作:)
这是我到目前为止得到的以及它给出的错误。
<form action="../PHP/moviedirectory.php" method="post">
<input type="text" name="search" placeholder="zoeken.."/>
</form>
<?php
$link = mysqli_connect("localhost", "*User*", "*Password*", "WEBSITE");
$searchq = null;
if (isset($_POST['search'])) {
global $searchq;
$searchq = $_POST['search'];
}
$query = mysqli_query($link, "SELECT * FROM WEBSITE.dbo.movie WHERE title
LIKE '%$searchq%' ORDER BY publication_year AND title DESC") or die("could
not search!");
$query = mysqli_query($link, "SELECT * FROM WEBSITE.dbo.movie WHERE
publication_year LIKE '%$searchq%' ORDER BY publication_year AND title
DESC") or die("could not search!");
$query = mysqli_query($link, "SELECT * FROM WEBSITE.dbo.movie WHERE genre
LIKE '%$searchq%' ORDER BY publication_year AND title DESC") or die("could
not search!");
$query = mysqli_query($link, "SELECT * FROM WEBSITE.dbo.movie WHERE director
LIKE '%$searchq%' ORDER BY publication_year AND title DESC") or die("could
not search!");
$count = mysqli_num_rows($query);
$bla = mysqli_fetch_array($query);
$result = mysqli_fetch_all($query);
$title = $bla['title'];
$director = $bla['director'];
$description = $bla['description'];
$cast = $bla['bla'];
$duration = $bla['duration'];
$year = $bla['year'];
$img = $bla['img'];
$url = $bla['url'];
$genre = $bla['genre'];
错误:
警告:mysqli_connect():( HY000 / 2002):因为无法连接 目标计算机已经积极拒绝连接。在 第6行的C:\ xampp \ htdocs \ php \ test \ zoeken.php
警告:mysqli_query()期望参数1为mysqli,boolean 在第13行的C:\ xampp \ htdocs \ php \ test \ zoeken.php中给出的不能 搜索!