jambla
asked on
Simple Filter in PHP or MySQL
Hi,
I'm making a simple movie catalog database. I want to add a filtering option on the catalog but I'm not sure how to do it properly.
Here my query to output the data:
========================== ========== ========== ========== ==========
$query = "SELECT * FROM movies_view ORDER BY `title` ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$id = $row["id"];
$title = $row["title"];
$owner = $row["owner"];
$type = $row["type"];
$imdb = $row["imdb"];
$region = $row["region"];
$row_color = ($row_count % 2) ? $color1 : $color2;
if ($imdb == "")
{
echo "<tr bgcolor=\"$row_color\" class=\"content_rows\">
<td width=\"20\" align=\"center\">$row_numb er</td>
<td width=\"20\" align=\"center\"><img src=\"no.png\" width=\"16\" height=\"16\" border=\"0\"></td>
<td width=\"420\">$title</td>
<td width=\"80\" class=\"content_rows\">$ow ner</td>
<td width=\"30\" class=\"content_rows\" align=\"center\">$type</td >
<td width=\"30\" class=\"content_rows\" align=\"center\">$region</ td>
</tr>";
}
else
echo "<tr bgcolor=\"$row_color\" class=\"content_rows\">
<td width=\"20\" align=\"center\">$row_numb er</td>
<td width=\"20\" align=\"center\"><a href=\"$imdb\" target=\"_blank\"><img src=\"yes.png\" width=\"16\" height=\"16\" border=\"0\"></a></td>
<td width=\"420\">$title</td>
<td width=\"80\" class=\"content_rows\">$ow ner</td>
<td width=\"30\" class=\"content_rows\" align=\"center\">$type</td >
<td width=\"30\" class=\"content_rows\" align=\"center\">$region</ td>
</tr>";
$row_count++;
$row_number++;
}
echo "</table>";
========================== ========== ========== ========== ==========
I've done a DISTINCT query to create a dropdown list of 'owner' I would like to have the option that when I select the owner in the dropdown menu that it will just output that specific owner.
thanks for your help!
I'm making a simple movie catalog database. I want to add a filtering option on the catalog but I'm not sure how to do it properly.
Here my query to output the data:
==========================
$query = "SELECT * FROM movies_view ORDER BY `title` ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result,
$id = $row["id"];
$title = $row["title"];
$owner = $row["owner"];
$type = $row["type"];
$imdb = $row["imdb"];
$region = $row["region"];
$row_color = ($row_count % 2) ? $color1 : $color2;
if ($imdb == "")
{
echo "<tr bgcolor=\"$row_color\" class=\"content_rows\">
<td width=\"20\" align=\"center\">$row_numb
<td width=\"20\" align=\"center\"><img src=\"no.png\" width=\"16\" height=\"16\" border=\"0\"></td>
<td width=\"420\">$title</td>
<td width=\"80\" class=\"content_rows\">$ow
<td width=\"30\" class=\"content_rows\" align=\"center\">$type</td
<td width=\"30\" class=\"content_rows\" align=\"center\">$region</
</tr>";
}
else
echo "<tr bgcolor=\"$row_color\" class=\"content_rows\">
<td width=\"20\" align=\"center\">$row_numb
<td width=\"20\" align=\"center\"><a href=\"$imdb\" target=\"_blank\"><img src=\"yes.png\" width=\"16\" height=\"16\" border=\"0\"></a></td>
<td width=\"420\">$title</td>
<td width=\"80\" class=\"content_rows\">$ow
<td width=\"30\" class=\"content_rows\" align=\"center\">$type</td
<td width=\"30\" class=\"content_rows\" align=\"center\">$region</
</tr>";
$row_count++;
$row_number++;
}
echo "</table>";
==========================
I've done a DISTINCT query to create a dropdown list of 'owner' I would like to have the option that when I select the owner in the dropdown menu that it will just output that specific owner.
thanks for your help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.