Hi
I'm just starting with php programming and need some help. This is just a test script I'm writing to see how it works.
I'm trying to search for phone of a certain make and price using a different search box for Make and price.
I want the results to return all the phones that is of a certain Make and below a certain price. And also if just make is searched for that all the ones with that make must be returned. The same with price.
I have been searching all over the internet and trying hundreds of different things but it just doesn't want to work.
Here is my code so far.
<?php
//connect to database
mysql_connect('localhost', 'rian', 'ri0401')
or die(mysql_error('Could not connect'));
mysql_select_db("test")
or die(mysql_error('Could not select database'));
//Identify verubles
$make = $_POST['Make'];
$price = $_POST['Price'];
//query
$sql=mysql_query("Select *
From test
Where Price <= '.%$price%.'
AND
Make Like '".$make."'")
or die(mysql_error());
while ($row=mysql_fetch_array($sql)){
echo $row['Make'];
echo '<br/>';
echo $row['Model'];
echo '<br/>';
echo $row['Price'];
echo '<br/><br/>';
}
?>
Any help will be appreciated.
Thanks
Rian