Jump to content

PHP If statment help


adam.jones2
 Share

Recommended Posts

Can anyone help we as to why this is not working, When you form is submited with value of "" i want it to search everything <?phpinclude ("db.php"); //Connect to the database using values from db.php ajones_cardealer $database variable value from db.php$connect = mysql_connect($host,$username,$password) or die('<p class="error">Unable to connect to the database server at this tim</p>'); //select the database we are going to use in this case itsmysql_select_db($database,$connect) or die('<p class="error">Unable to connect to the database at this time.</p>'); // Get the posted value based on option select. $Make = $_POST['make'];$Min_Price = $_POST['pf'];$Max_Price = $_POST['pt']; // Create SQL query to find the row with make_id.$query = "SELECT * FROM site_cars WHERE car_Make = $Make AND car_price BETWEEN $Min_Price AND $Max_Price";// Execute the query to get number of rows that contain search kewords$numresults=mysql_query ($query);$row_num_links_main =mysql_num_rows ($numresults);//output results//If Query doesn't return any results search * if($row_num_links_main < 1){ $query_all = "SELECT * FROM site_car"; $numresults=mysql_query ($query_all); $row_num_links_main1 = mysql_num_rows ($numresults);}?>

Edited by adam.jones2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...