让搜索脚本工作的问题 [英] problem getting search script to work

查看:55
本文介绍了让搜索脚本工作的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我尝试通过Dreamweaver工作,但事实并非如此。

所以我在互联网上找到了一个例子,我完全按照搜索脚本无效。有人可以帮我这个吗。

感谢您的帮助。表单和脚本在同一页面上。


[PHP]<?php require_once(''../ Connections / rs_ais.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"含量=" text / html的;字符集= ISO-8859-1" />

< title> search< / title>

< link href =" ../ css / ais.css"的rel ="样式表"类型= QUOT;文本/ CSS" />


< / head>


< body>

< table width =" 100%" border =" 0">

<?php include(" ../ template / header.php"); ?>

<?php include(" ../ template / leftnav.php"); ?>


< td colspan =" 2" valign =" top">< p>< strong>< br />

< / strong>搜索案例< / p>

< ; form name =" search"方法= QUOT;交" action ="<?= $ PHP_SELF?>">

搜索:

< input name =" find"类型= QUOT;文本"类= QUOT; aisteam" />

in

< select name =" field" class =" aisteam">

< option value =" issue_title"> Issue Title< / option>

< option value =" case_number" >案例编号< /选项>

<选项值=" issue_description">问题说明< /选项>

< option value =" customer_acct" >客户帐户< /选项>

<选项价值="状态">状态< /选项>

< option value =" priority"> ;优先级< /选项>

<选项价值=" issue_date">发行日期< /选项>

< option value =" opened_by">打开方式< / option>

< option value =" assigned_to">已分配< /选项>

< option value =" issue_type">问题输入< / option>

< / select>


< input type =" hidden"名称= QUOT;搜索"值= QUOT;是" />

< input name =" search"类型= [提交"类= QUOT; aisteam"值= [搜寻" />

< / form>


< p>& nbsp;< / p>



< table width =" 95%"边界=" 0" CELLSPACING = QUOT 1 QUOT; cellpadding =" 1">


< tr>

< th scope =" col">状态< / th>

< th scope =" col"> Issue Title< / th>

< th scope =" col"> Customer Account< ; / th>

< th scope =" col"> Priortiy< / th>

< th scope =" col">问题类型< ; / th>

< th scope =" col">创建日期< / th>

< / tr>

< tr class =" aisteam">


<?php

//只有在提交表格后才会显示/>
if($ searching ==" yes")

{

echo"< h3> Results< / h3>< p>英寸;


//如果他们没有输入搜索词,我们会给他们一个错误

if($ find =="")

{

echo"< p>请输入搜索字词;

退出;

}


//否则我们连接到我们的数据库

#mysql_connect(" mysql.yourhost.com"," ; user_name"," password")或die(mysql_error());

mysql_select_db(" aisteam")或die(mysql_error());


//我们预先进行了一些过滤

$ find = strtoupper($ find);

$ find = strip_tags($ find);

$ find = trim($ find);


//现在我们在用户指定的字段中搜索我们的搜索词

$ data = mysql_query(" SELECT * FROM issue_tracker WHERE $ field LIKE'%$查找% '' ");


//我们显示结果

while($ result = mysql_fetch_array($ data))

{

/ *< td><?php echo $ result [''status'']; ?>< / td>

< td><?php echo $ result [''issue_title'']; ?>< / td>

< td><?php echo $ result [''customer_acct'']; ?>< / td>

< td><?php echo $ result [''priority'']; ?>< / td>

< td><?php echo $ result [''issue_type'']; ?>< / td>

< td><?php echo $ result [''created_date'']; ?>< / td>

< / tr> * /

echo"< td>";

echo $ result [''status''];

echo"< / td>" ;;

echo"< td>" ;;

echo $ result [''issue_title''];

echo"< / td>" ;;

echo"< td> " ;;

echo $ result [''customer_acct''];

echo"< / td>" ;;

echo "< td>";

echo $ result [''priority''];

echo"< / td>" ;;

echo"< td>" ;;

echo $ result [''issue_type''];

echo"< / td> " ;;

echo"< td>" ;;

echo $ result [''created_date''];

echo" ;< / td>" ;;

echo"< / tr>" ;;


}


//这会计算数字或结果 - 如果没有,它会给他们一条消息,说明

$ anymatches = mysql_num_rows($ data);

if($ anymatches == 0)

{

echo"抱歉,我们找不到符合您查询的条目< BR><峰; br>英寸;

}


//我们提醒他们搜索了什么

echo"< b>搜索:< ; / b个" 。$找到;

}

echo"< / table>"

?>




<?php include(" ../ template / footer.php");

?>

[/ PHP]

Hi I tried getting this to work through dreamweaver but it did not.
So i found a n example on the internet , i followed everything exactly the search script does not work. Could somebody help me this please.
Thanks for your help in advance. The form and script are on the same page.

[PHP]<?php require_once(''../Connections/rs_ais.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=iso-8859-1" />
<title>search</title>

<link href="../css/ais.css" rel="stylesheet" type="text/css" />

</head>

<body>
<table width="100%" border="0">
<?php include("../template/header.php"); ?>
<?php include("../template/leftnav.php"); ?>

<td colspan="2" valign="top"><p><strong><br />
</strong>Search Cases</p>
<form name="search" method="post" action="<?=$PHP_SELF?>">
Search for:
<input name="find" type="text" class="aisteam" />
in
<select name="field" class="aisteam">
<option value="issue_title">Issue Title</option>
<option value="case_number">Case Number</option>
<option value="issue_description">Issue description</option>
<option value="customer_acct">Customer Account</option>
<option value="status">Status</option>
<option value="priority">Priority</option>
<option value="issue_date">Issue Date</option>
<option value="opened_by">Opened By</option>
<option value="assigned_to">Assigned</option>
<option value="issue_type">Issue Type</option>
</select>

<input type="hidden" name="searching" value="yes" />
<input name="search" type="submit" class="aisteam" value="Search" />
</form>


<p>&nbsp;</p>


<table width="95%" border="0" cellspacing="1" cellpadding="1">


<tr>
<th scope="col">Status</th>
<th scope="col">Issue Title </th>
<th scope="col">Customer Account </th>
<th scope="col">Priortiy</th>
<th scope="col">Issue Type </th>
<th scope="col">Created Date </th>
</tr>
<tr class="aisteam">

<?php
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "<h3>Results</h3><p>";

//If they did not enter a search term we give them an error
if ($find == "")
{
echo "<p>Please enter a search term";
exit;
}

// Otherwise we connect to our Database
#mysql_connect("mysql.yourhost.com", "user_name", "password") or die(mysql_error());
mysql_select_db("aisteam") or die(mysql_error());

// We preform a bit of filtering
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);

//Now we search for our search term, in the field the user specified
$data = mysql_query("SELECT * FROM issue_tracker WHERE $field LIKE''%$find%''");

//And we display the results
while($result = mysql_fetch_array( $data ))
{
/* <td><?php echo $result[''status'']; ?></td>
<td><?php echo $result[''issue_title'']; ?></td>
<td><?php echo $result[''customer_acct'']; ?></td>
<td><?php echo $result[''priority'']; ?></td>
<td><?php echo $result[''issue_type'']; ?></td>
<td><?php echo $result[''created_date'']; ?></td>
</tr>*/
echo "<td>";
echo $result[''status''];
echo "</td>";
echo "<td>";
echo $result[''issue_title''];
echo "</td>";
echo "<td>";
echo $result[''customer_acct''];
echo "</td>";
echo "<td>";
echo $result[''priority''];
echo "</td>";
echo "<td>";
echo $result[''issue_type''];
echo "</td>";
echo "<td>";
echo $result[''created_date''];
echo "</td>";
echo "</tr>";

}

//This counts the number or results - and if there wasn''t any it gives them a little message explaining that
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}

//And we remind them what they searched for
echo "<b>Searched For:</b> " .$find;
}
echo "</table>"
?>



<?php include("../template/footer.php");
?>
[/PHP]

推荐答案

PHP_SELF?>">

搜索:

< input name =" find"类型= QUOT;文本"类= QUOT; aisteam" />

in

< select name =" field" class =" aisteam">

< option value =" issue_title"> Issue Title< / option>

< option value =" case_number" >案例编号< /选项>

<选项值=" issue_description">问题说明< /选项>

< option value =" customer_acct" >客户帐户< /选项>

<选项价值="状态">状态< /选项>

< option value =" priority"> ;优先级< /选项>

<选项价值=" issue_date">发行日期< /选项>

< option value =" opened_by">打开方式< / option>

< option value =" assigned_to">已分配< /选项>

< option value =" issue_type">问题输入< / option>

< / select>


< input type =" hidden"名称= QUOT;搜索"值= QUOT;是" />

< input name =" search"类型= [提交"类= QUOT; aisteam"值= [搜寻" />

< / form>


< p>& nbsp;< / p>



< table width =" 95%"边界=" 0" CELLSPACING = QUOT 1 QUOT; cellpadding =" 1">


< tr>

< th scope =" col">状态< / th>

< th scope =" col"> Issue Title< / th>

< th scope =" col"> Customer Account< ; / th>

< th scope =" col"> Priortiy< / th>

< th scope =" col">问题类型< ; / th>

< th scope =" col">创建日期< / th>

< / tr>

< tr class =" aisteam">


<?php

//只有在提交表格后才会显示/>
if(
PHP_SELF?>">
Search for:
<input name="find" type="text" class="aisteam" />
in
<select name="field" class="aisteam">
<option value="issue_title">Issue Title</option>
<option value="case_number">Case Number</option>
<option value="issue_description">Issue description</option>
<option value="customer_acct">Customer Account</option>
<option value="status">Status</option>
<option value="priority">Priority</option>
<option value="issue_date">Issue Date</option>
<option value="opened_by">Opened By</option>
<option value="assigned_to">Assigned</option>
<option value="issue_type">Issue Type</option>
</select>

<input type="hidden" name="searching" value="yes" />
<input name="search" type="submit" class="aisteam" value="Search" />
</form>


<p>&nbsp;</p>


<table width="95%" border="0" cellspacing="1" cellpadding="1">


<tr>
<th scope="col">Status</th>
<th scope="col">Issue Title </th>
<th scope="col">Customer Account </th>
<th scope="col">Priortiy</th>
<th scope="col">Issue Type </th>
<th scope="col">Created Date </th>
</tr>
<tr class="aisteam">

<?php
//This is only displayed if they have submitted the form
if (


searching ==" yes")

{

echo"< h3> ;结果< / H3>< p为H.英寸;


//如果他们没有输入搜索词我们就给他们一个错误

if(
searching =="yes")
{
echo "<h3>Results</h3><p>";

//If they did not enter a search term we give them an error
if (


find = ="")

{

echo"< p>请输入搜索字词;

退出;

}


//否则我们连接到我们的数据库

#mysql_connect(" mysql.yourhost.com"," ; user_name"," password")或die(mysql_error());

mysql_select_db(" aisteam")或die(mysql_error());


//我们预先进行了一些过滤
find == "")
{
echo "<p>Please enter a search term";
exit;
}

// Otherwise we connect to our Database
#mysql_connect("mysql.yourhost.com", "user_name", "password") or die(mysql_error());
mysql_select_db("aisteam") or die(mysql_error());

// We preform a bit of filtering


这篇关于让搜索脚本工作的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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