Hi Everybody,
I think it's fairly simple, but i am a noob in PHP so need help from advanced coders.
I have MySQL table which is being filled up everyday, there are 7 fields in the table (submitter, choosebank, choosetype, ampaid, amret, date, descript).
What I need is to create a search.php which will be looking up data in all fields and printing it on the screen and the search should be filtered. What I mean is when a user wants to search for data let's say using submitter who's name is Mitchel then it should search for all data and print all rows containing submitter (Mitchel) and the rest six fields. And if user searches let's say using submitter (Mitchel) and a certain date (let's say DEC-25-2011) then it should find all data containing Mitchel and DEC-25-2011 in the same row and print all rows which contain the same search parameter and the rest of the fields.
Any help would be greatly appreciated!
Here is the code I have so far, but it doesn't work.
<code>
<?php
include ("blocks/db.php");
$sql = mysql_query("SELECT * FROM banks WHERE submitter LIKE '$sub' or choosebank LIKE '$bank' or choosetype LIKE '$type' or $money_column LIKE '$money_column' or $money_value LIKE '$money_amount' or inputdate LIKE '$inputdate' or descript LIKE '$descript'") or die(mysql_error());
echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>";
echo "<tr>";
echo "<td width='100'>Submitter</td>";
echo "<td width='90'>Bank</td>";
echo "<td width='110'>Type of Payment</td>";
echo "<td width='110'>Amount Paid</td>";
echo "<td width='110'>Amount Returned</td>";
echo "<td width='100'>Date</td>";
echo "<td width='366'>Description</td>";
echo "</tr>";
echo "</table>";
while ($row = mysql_fetch_array($sql)){
echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>";
echo "<tr>";
echo "<td width='100'>$row[submitter]</td>";
echo "<td width='90'>$row[choosebank]</td>";
echo "<td width='110'>$row[choosetype]</td>";
echo "<td width='110'>$row[ampaid]</td>";
echo "<td width='110'>$row[amret]</td>";
echo "<td width='100'>$row[date]</td>";
echo "<td width='366'>$row[descript]</td>";
echo "</tr>";
echo "</table>";
}
?>
</code>