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.dt d">
<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_ti tle">Issue Title</option>
<option value="case_num ber">Case Number</option>
<option value="issue_de scription">Issu e description</option>
<option value="customer _acct">Customer Account</option>
<option value="status"> Status</option>
<option value="priority ">Priority</option>
<option value="issue_da te">Issue Date</option>
<option value="opened_b y">Opened By</option>
<option value="assigned _to">Assigned</option>
<option value="issue_ty pe">Issue Type</option>
</select>
<input type="hidden" name="searching " value="yes" />
<input name="search" type="submit" class="aisteam" value="Search" />
</form>
<p> </p>
<table width="95%" border="0" cellspacing="1" cellpadding="1" >
<tr>
<th scope="col">Sta tus</th>
<th scope="col">Iss ue Title </th>
<th scope="col">Cus tomer Account </th>
<th scope="col">Pri ortiy</th>
<th scope="col">Iss ue Type </th>
<th scope="col">Cre ated Date </th>
</tr>
<tr class="aisteam" >
<?php
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "<h3>Result s</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($fin d);
$find = strip_tags($fin d);
$find = trim ($find);
//Now we search for our search term, in the field the user specified
$data = mysql_query("SE LECT * FROM issue_tracker WHERE $field LIKE'%$find%'") ;
//And we display the results
while($result = mysql_fetch_arr ay( $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=mys ql_num_rows($da ta);
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>Searche d For:</b> " .$find;
}
echo "</table>"
?>
<?php include("../template/footer.php");
?>
[/PHP]
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.dt d">
<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_ti tle">Issue Title</option>
<option value="case_num ber">Case Number</option>
<option value="issue_de scription">Issu e description</option>
<option value="customer _acct">Customer Account</option>
<option value="status"> Status</option>
<option value="priority ">Priority</option>
<option value="issue_da te">Issue Date</option>
<option value="opened_b y">Opened By</option>
<option value="assigned _to">Assigned</option>
<option value="issue_ty pe">Issue Type</option>
</select>
<input type="hidden" name="searching " value="yes" />
<input name="search" type="submit" class="aisteam" value="Search" />
</form>
<p> </p>
<table width="95%" border="0" cellspacing="1" cellpadding="1" >
<tr>
<th scope="col">Sta tus</th>
<th scope="col">Iss ue Title </th>
<th scope="col">Cus tomer Account </th>
<th scope="col">Pri ortiy</th>
<th scope="col">Iss ue Type </th>
<th scope="col">Cre ated Date </th>
</tr>
<tr class="aisteam" >
<?php
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "<h3>Result s</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($fin d);
$find = strip_tags($fin d);
$find = trim ($find);
//Now we search for our search term, in the field the user specified
$data = mysql_query("SE LECT * FROM issue_tracker WHERE $field LIKE'%$find%'") ;
//And we display the results
while($result = mysql_fetch_arr ay( $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=mys ql_num_rows($da ta);
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>Searche d For:</b> " .$find;
}
echo "</table>"
?>
<?php include("../template/footer.php");
?>
[/PHP]
Comment