搜索引擎无法正常运行 [英] search engine cant function

查看:78
本文介绍了搜索引擎无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的求职门户搜索引擎,求职者可以通过快速搜索找到工作。但它无法工作......是mysql查询有问题吗? Thanx ..


界面

[HTML]< html>

< head>

< title> UMS电子工作门户< / title>

< meta http-equiv =" Content-Type"含量=" text / html的; charset = iso-8859-1">

< style type =" text / css">

<! -

body {

background-color:#FFFFFF;

}

body,td,th {

颜色:#000000;

}

a:链接{

颜色:#FFFFFF;

}

a:访问{

颜色:#FFFFFF;

}

a:悬停{

颜色:#CCCCCC;

}

a:活跃{

颜色:#CCCCCC;

}

- >

< / style>< / head>


< body bgcolor =" #FFFFFF" text ="#000000">

< form name =" search job"方法= QUOT;交" action =" jobsearch_act.php">

< p>& nbsp;< / p>


< table width =" 600 QUOT; border =" 0">

< tr>

< td colspan =" 3">< font color ="#000000">< strong> QUICK SEARCH< / strong>< / font>< / td> ;

< / tr>

< tr>

< td width =" 217">< font color ="#000000"> Keyword(s)< / font>< font color ="#000000" >& nbsp;< / font>< / td>

< td width =" 30">< div align =" center">< strong> :< / strong>< / div>< / td>

< td width =" 339">< input name =" keyword"类型= QUOT;文本" maxlength =" 30">< / td>

< / tr>

< tr>

< td>< font color ="#000000">职位类别< / font> < / td>

< td>< div align =" center">< strong>:< / strong>< / div>< / td>

< td>< select name =" jobCategory">

<选项选项>< / option>

< option> ;会计< /选项>

<选项>广告< /选项>

<选项>农业< /选项>

<选项>银行< /选项>

<选项>生物技术< /选项>

<选项>化学工程< / option>

< option> Chemistry< / option>

< option> Clerical / Admin< / option>

< option>客户服务< / option>

< option> Education< / option>

< option> Electronics Eng< / option>

< option> Food Tech< / option>

< ;选项>一般工人< /选项>

<选项>图形< /选项>

<选项>医疗保健< /选项>

<选项>酒店/食品< /选项>

<选项>人力资源< /选项>

<选项> IT /计算机< /选项>

<选项>记者/编辑< /选项>

<选项>制造< /选项>

<选项>营销< /选项>

<选项>机械英语< /选项>

<选项>媒体/娱乐< /选项>

<选项> ;个人护理< / option>

< option> Publishing< / option>

< option> Purchasing< / option>

< ;选项>数量调查< /选项>

<选项>销售< /选项>

<选项>科学/技术< ; / option>

< option> Secretarial< / option>

< option> Social Services< / option>

< option> ;培训< /选项>

<选项>其他< /选项>

< / select>< / td>

< ; / tr>

< tr>

< td>< font color ="#000000">工作地点< / font>< / td>

< td>< div align =" center">< strong>:< / strong>< / div>< / td>

< td>< select name =" jobLocation"> ;

<选择选项>< /选项>

<选项> Perlis< /选项>

<选项>槟城< / option>

< option> Kedah< / option>

< option> Perak< / option>

< option> Kelantan< ; / option>

< option> Terengganu< / option>

< option> Pahang< / option>

< option>雪兰莪< / option>

<选项>吉隆坡< /选项>

<选项> Negeri Sembilan< / option>

< ;选项> Melaka< / option>

< option&g t; Johor< / option>

< option> Labuan< / option>

< option> Sabah< / option>

< ;选项>砂拉越< /选项>

< / select>< / td>

< / tr>

< td colspan =" 3">< div align =" center">

< input type = hidden name = act value = adduser>


< input name ="搜索"类型= [提交" ID = [搜寻" value =" Search">

< / div>< / td>

< / table>

< /表格>

< p>< img src =" image / bottom%20banner.jpg"宽度= QUOT; 955" height =" 46">< / p>

< / body>

< / html> [/ HTML]


用于搜索引擎的PHP代码

[PHP]<?php

//数据库连接所需的文件

require(" database.php");

if(isset($ _ POST [''keyword''])){

$ keyword = mysql_real_escape_string($ _POST [" keyword"]);

$ category = mysql_real_escape_string($ _ POST [" jobCategory"]);

$ location = mysql_real_escape_string($ _ POST [" jobLocation"]);


echo"< p align = center>< center>< font face =''Arial''size =''3''>搜索结果< / p>" ;;

//当他们没有输入关键字时给出的错误。

if($ keyword ==""){

echo"< p align = center>< font face =''Arial''size = ''2''> Opps ..你忘了输入关键字;

echo"< br>< br>< br>< a href =''jobsearch.php? ''>< font face =''Arial''size ='''''>返回< / a>" ;;


退出;

}


$ sql =" SELECT * FROM job WHERE jobCategory喜欢''$ jobCategory''和jobLocation喜欢''$ jobLocation''和jobTitle LIKE''%$ keyword%''OR jobType LIKE''%$ keyword%''OR jobPosition LIKE''%$ keyword%''" ;;


$ anymatches = @mysql_num_rows($ data) ;

if($ anymatches == 0)

{

echo"< center>< font face =''Arial''大小= '' 2 '' >对不起,找不到工作。< / center>< br>< br>" ;;

echo"< br>< br>< br>< a href =''jobsearch.php? ''>< font face =''Arial''size =''2''>返回< / a>" ;;


exit();


}


$ bgcolor ="#f1f1f1" ;;

echo"< table border =''1 ''align = center>" ;;

echo"

< TABLE width = 70%align = center cellpadding = 0 cellspacing = 0> < tr>


< td bgcolor =''dfdfdf''>& nbsp;< font face =''arial''color =''#000000'' size =''3''>职位名称< / font>< / td>

< td bgcolor =''dfdfdf''>& nbsp;< font face =' 'arial''color =''#000000''size =''3''>公司< / font>< / td>

< td bgcolor =''dfdfdf''> ;& nbsp;< font face =''arial''color =''#000000''size ='''3''>位置< / font>< / td>< / tr>

< td bgcolor =''dfdfdf''>& nbsp;< font face =''arial''color =''#000000''size ='''3''>发布日期< ; / font>< / td>< / tr>


< / tr>" ;;

$ counter = 0;

while($ result = @mysql_fetch_array($ data)){

if($ counter == 3) {$ / $

$ counter = 0;

}


if($ bgcolor ==' '#f1f1f1''){$ bgcolor =''#fffff'';;}

else {$ bgcolor =''#f1f1f1'';}


echo"< tr>< td align = left bgcolor = $ bgcolor id =''title''>< a href =''jobsearch_result.php?id = {$ result [''ID''] }''>< font face =''Arial''size ='''''> {$ result [''jobTitle'']}< / a>< / td>

< td align = left bgcolor = $ bgcolor id =''title''>< font face =''Arial''size ='''''> {$ result [''companyName'' ]}< / td>

< td align = left bgcolor = $ bgcolor id =''title''>< font face =''Arial''size =''2' '> {$ result [''jobLocation'']}< / td>

< td align = left bgcolor = $ bgcolor id =''title '>< font face =''Arial''size ='''''> {$ result [''datePosted'']}< / td>

< / tr> ;英寸;

$ counter = $ counter + 1;

}


echo"< / table>" ;; echo"< font face =''Arial''size ='''''>关键字:" 。$关键词;

echo"< br>< br>< br>< a href =''jobsearch.php? ''>< font face =''Arial''size ='''''>返回< / a>" ;;

}




?> [/ PHP]

Below is my search engine for job portal which jobseeker can find the job through quick search. But it cant work... Is it mysql query got problem?? Thanx..

Interface
[HTML]<html>
<head>
<title>UMS e-Job Portal</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
body,td,th {
color: #000000;
}
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:hover {
color: #CCCCCC;
}
a:active {
color: #CCCCCC;
}
-->
</style></head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="search job" method="post" action="jobsearch_act.php">
<p>&nbsp;</p>

<table width="600" border="0">
<tr>
<td colspan="3"><font color="#000000"><strong>QUICK SEARCH</strong></font></td>
</tr>
<tr>
<td width="217"><font color="#000000">Keyword(s)</font><font color="#000000">&nbsp;</font></td>
<td width="30"><div align="center"><strong>:</strong></div></td>
<td width="339"><input name="keyword" type="text" maxlength="30"></td>
</tr>
<tr>
<td><font color="#000000">Job Category</font> </td>
<td><div align="center"><strong>:</strong></div></td>
<td><select name="jobCategory">
<option selected></option>
<option>Accounting</option>
<option>Advertising</option>
<option>Agriculture</option>
<option>Banking</option>
<option>Biotechnology</option>
<option>Chemical Eng</option>
<option>Chemistry</option>
<option>Clerical/Admin</option>
<option>Customer Service</option>
<option>Education</option>
<option>Electronics Eng</option>
<option>Food Tech</option>
<option>General Workers</option>
<option>Graphics</option>
<option>Healthcare</option>
<option>Hotel/Food</option>
<option>Human Resources</option>
<option>IT/Computer</option>
<option>Journalist/Editor</option>
<option>Manufacturing</option>
<option>Marketing</option>
<option>Mechanical Eng</option>
<option>Media/Entertain</option>
<option>Personal Care</option>
<option>Publishing</option>
<option>Purchasing</option>
<option>Quantity Survey</option>
<option>Sales</option>
<option>Science/Tech</option>
<option>Secretarial</option>
<option>Social Services</option>
<option>Training</option>
<option>Others</option>
</select></td>
</tr>
<tr>
<td><font color="#000000">Job Location</font></td>
<td><div align="center"><strong>:</strong></div></td>
<td><select name="jobLocation">
<option selected></option>
<option>Perlis</option>
<option>Penang</option>
<option>Kedah</option>
<option>Perak</option>
<option>Kelantan</option>
<option>Terengganu</option>
<option>Pahang</option>
<option>Selangor</option>
<option>Kuala Lumpur</option>
<option>Negeri Sembilan</option>
<option>Melaka</option>
<option>Johor</option>
<option>Labuan</option>
<option>Sabah</option>
<option>Sarawak</option>
</select></td>
</tr>
<td colspan="3"><div align="center">
<input type=hidden name=act value=adduser>

<input name="Search" type="submit" id="Search" value="Search">
</div></td>
</table>
</form>
<p><img src="image/bottom%20banner.jpg" width="955" height="46"></p>
</body>
</html>[/HTML]


PHP CODE for search engine
[PHP]<?php
//required file for database connection
require("database.php");
if (isset($_POST[''keyword''])) {
$keyword = mysql_real_escape_string($_POST["keyword"]);
$category=mysql_real_escape_string($_POST["jobCategory"]);
$location=mysql_real_escape_string($_POST["jobLocation"]);

echo"<p align=center><center><font face=''Arial'' size=''3''>Search Results</p>";
//An error given when they did not enter a keyword.
if ($keyword== "") {
echo "<p align=center><font face=''Arial'' size=''2''>Opps.. You forgot enter a keyword(s)";
echo"<br><br><br><a href=''jobsearch.php? ''><font face=''Arial'' size=''2''>Back</a>";

exit;
}

$sql="SELECT * FROM job WHERE jobCategory like ''$jobCategory'' AND jobLocation like ''$jobLocation'' AND jobTitle LIKE ''%$keyword%'' OR jobType LIKE ''%$keyword%''OR jobPosition LIKE''%$keyword%''";

$anymatches = @mysql_num_rows($data);
if ($anymatches == 0)
{
echo "<center><font face=''Arial'' size=''2''> Sorry, no job found.</center><br><br>";
echo"<br><br><br><a href=''jobsearch.php? ''><font face=''Arial'' size=''2''>Back</a>";

exit();

}

$bgcolor="#f1f1f1";
echo "<table border=''1''align=center>";
echo"
<TABLE width=70% align=center cellpadding=0 cellspacing=0> <tr>

<td bgcolor=''dfdfdf'' >&nbsp;<font face=''arial'' color=''#000000'' size=''3''>Job Title</font></td>
<td bgcolor=''dfdfdf'' >&nbsp;<font face=''arial'' color=''#000000'' size=''3''>Company</font></td>
<td bgcolor=''dfdfdf'' >&nbsp;<font face=''arial'' color=''#000000'' size=''3''>Location</font></td></tr>
<td bgcolor=''dfdfdf'' >&nbsp;<font face=''arial'' color=''#000000'' size=''3''>Date Posted</font></td></tr>

</tr>";
$counter = 0;
while($result = @mysql_fetch_array( $data )){
if ($counter == 3) {


$counter = 0;
}

if($bgcolor==''#f1f1f1''){$bgcolor=''#ffffff'';}
else{$bgcolor=''#f1f1f1'';}

echo "<tr><td align=left bgcolor=$bgcolor id=''title''><a href=''jobsearch_result.php?id={$result[''ID'']}''><font face=''Arial'' size=''2''>{$result[''jobTitle'']}</a></td>
<td align=left bgcolor=$bgcolor id=''title''><font face=''Arial'' size=''2''>{$result[''companyName'']}</td>
<td align=left bgcolor=$bgcolor id=''title''><font face=''Arial'' size=''2''>{$result[''jobLocation'']}</td>
<td align=left bgcolor=$bgcolor id=''title''><font face=''Arial'' size=''2''>{$result[''datePosted'']}</td>
</tr>";
$counter = $counter + 1;
}

echo "</table>"; echo"<font face=''Arial'' size=''2''>Keyword: " .$keyword;
echo"<br><br><br><a href=''jobsearch.php? ''><font face=''Arial'' size=''2''>Back</a>";
}



?> [/PHP]

推荐答案

_POST [''keyword''])){
_POST[''keyword''])) {


keyword = mysql_real_escape_string (
keyword = mysql_real_escape_string(


_POST [" keyword"]);
_POST["keyword"]);


这篇关于搜索引擎无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆