<?php
$where = '';
if ( $_POST['A'] ) { $where = "'A'"; }
if ( $_POST['B'] ) {
if ( $where ) {
$where .= " or `column_1`='B'";
} else {
$where = "'B'";
}
}
if ( $_POST['C'] ) {
if ( $where ) {
$where .= " or `column_1`='C'";
} else {
$where = "'C'";
}
}
mysql_connect("host", "user", "pass");
mysql_select_db("db_name");
$result = mysql_query("SELECT * FROM `table` WHERE `column_1`=$where;");
echo '<table>';
while ( $row = mysql_fetch_array( $result ) ) {
echo "<tr>
<td>
$row[column_1]
</td>
<td>
$row[column_2]
</td>
<td>
$row[column_3]
</td>
</tr>
";
}
echo '</table>';
mysql_close();
?>
Не съм го тествал, ама не виждам да има грешки, така че ще работи.Редактирано от Tpaвъл на 12.05.07 01:13.