Jump to content

PHP If statment help


adam.jones2

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);}?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...