I did terminate my query line and removed brackets around the OR statements. Now when you run the qury the search keeps executing but no result occurs- it is stuck in a loop- have a look:
www.mindseyemidlands.co.uk/notts_quality/info_resource/search.php
here is my code:
<?php
include("connect.php");
$search = $_POST['searchit'];
$sql = "SELECT qualityadmin.search_section, qualityadmin.search_title, qualityadmin.search_url,
faq.search_section, faq.search_title, faq.search_url,
jargon.search_section, jargon.search_title, jargon.search_url
FROM qualityadmin AS qualityadmin, faq AS faq, jargon AS jargon
WHERE qualityadmin.search_title LIKE '%$search%'
OR faq.search_title LIKE '%$search%'
OR jargon.search_title LIKE '%$search%'";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
// begin output here:
echo '<style type="text/css">
#myTable td {
font-family:arial, helvetica, sans-serif;
font-size: 14px;
}
.heading {
background:#eee;
color: #0000cc;
}
</style>
<table cellpadding="2" cellspacing="0" border="1" id="myTable" width="700px">
<tr>
<td class="heading" colspan="3">Result</td>
</tr>
<tr>
<td colspan="3">' . $row[search_title] .'</td>
</tr>
<tr>
<td colspan="3">' . $row[search_section] .'</td>
</tr>
<tr>
<td colspan="3">' . $row[search_url] .'</td>
</tr>
</table>';
}
}
?>
on another note I have done some research on FULL TEXT searching and have reaffirmed I can most certainly not search multiple tables using that approach. I have however found a way of searching just the qualityadmin table- im posting this in case someone else finds it useful in future:
<?php
include("connect.php");
$search = $_POST['search'];
$sql= "SELECT * FROM qualityadmin WHERE MATCH (quality_name, local_agency, contact, what_is_it, who_what_apply, how_work, resource_implications, how_meet_standards, widespread, pros_cons, benefits) AGAINST ('" . stripslashes (str_replace (""", "\"", ($_POST['search']))) . "' IN BOOLEAN MODE)";
$result = mysql_query($sql, $connection) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
// begin output here:
echo '<style type="text/css">
#myTable td {
font-family:arial, helvetica, sans-serif;
font-size: 14px;
}
.heading {
background:#eee;
color: #0000cc;
}
</style>
<table cellpadding="2" cellspacing="0" border="1" id="myTable" width="700px">
<tr>
<td class="heading" colspan="3">Result</td>
</tr>
<tr>
<td colspan="3">' . $row['search_title'] .'</td>
</tr>
<tr>
<td colspan="3">' . $row['search_section'] .'</td>
</tr>
<tr>
<td colspan="3">' . $row['search_url'] .'</td>
</tr>
</table>';
}
}
?>
as it stands though im still in a position where I cannot search multiple tables