Forum Moderators: coopster
mysql_select_db('search_links');
$query = "select * from links ";
$result = mysql_query($query); $num_results = mysql_num_rows($result);
echo '<p>Number of books found: '.$num_results.'</p>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<p><strong>'.($i+1).'. Title: ';
echo htmlspecialchars(stripslashes($row['type_prop']));
echo '</strong><br />Author: ';
echo stripslashes($row['area_code']);
echo '<br />ISBN: ';
echo stripslashes($row['price_range']);
echo '<br />Price: ';
echo stripslashes($row['saved_link']);
echo '</p>';
}
The above query prints the entire table and I would like a query that limits to the form choices indicated above. I should have come here and ask hours ago but pride got in my way.:)
mysql_select_db('search_links');
$query = '
SELECT *
FROM links
WHERE '.$type_prop.' = \''.$select_type.'\'
AND '.$area_code.' = \''.$select_area.'\'
AND '.$price_range.' = \''.$select_price.'\'
';
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<p>Number of books found: '.$num_results.'</p>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_row($result);
echo '<p><strong> Property Type: ';
echo (stripslashes($row['0']));
echo '</strong><br />Area Code: ';
echo stripslashes($row['1']);
echo '<br />Price Range: ';
echo stripslashes($row['2']);
echo '<br />Link: ';
echo stripslashes($row['3']);
echo '</p>';
}