Forum Moderators: coopster
So you see the table above.
The form needs to be able to search the "H Fields for one term.
Now i have got something working kind of.
I can get the search to work for the term
I have to problems though one is formating of the output second problem is the query returns duplicate data.
Now the data is not duplicated in the table only the output of the query.
Here is the code i have so far.
<code>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
Search Word: <input type="text" name="query">
<input type="SUBMIT" value="Search!">
</form>
<?
$username = "street15486";
$password = "startup";
$hostname = "localhost";
$db = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$query = addslashes($_POST['query']);
mysql_select_db("ajumbled_bcup2006", $db);
$sql = mysql_query("SELECT * FROM compendium WHERE h1 LIKE '" . $query . "' OR h2 LIKE '" . $query . "' OR h3 LIKE '" . $query ."'") or die (mysql_error());
while($row=mysql_fetch_array($sql)){
foreach($row as $field) {
echo " , " . $field;
}
echo "<br />";
}
mysql_close($db);
?>
</code>
Id like to have the query not produce a duplicate.
Id also like to have the output in a table form like you would see in a normal sql query output with table filed headers and formatted in cells.
IM stuck at this point and do not know what to do or how to resolve it any further.
I hope someone can help
[edited by: Street14 at 6:00 am (utc) on Nov. 8, 2006]