deansaddigh Posted January 21, 2010 Share Posted January 21, 2010 basically nothing is brought back, which it should be. if($_SERVER['REQUEST_METHOD'] == "POST") { /*get the posted data*/ $country = $_POST["country"]; $region = $_POST["region"]; $town = $_POST["town"]; $weeks = $_POST["weeks"]; } /*************** * Check to see if variables are empty **************/ if (isset($country,$region,$town,$weeks)) { $query = "SELECT * FROM school WHERE town= '.$town.'"; $result = mysql_query($query, $conn) or die ("Unable to perform query"); } /*************** * get values from sql query **************/ while($row= mysql_fetch_array($result)) { echo $name = $row['name']; echo $address = $row['address']; echo $school_fact = $row["school_facts"]; echo $general_info = $row["general_info"]; echo $country =$row["country"]; } if i get rid of the where clause it works. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted January 21, 2010 Share Posted January 21, 2010 $query = "SELECT * FROM school WHERE town= '.$town.'"; Did you mean: $query = "SELECT * FROM school WHERE town= '".$town."'"; Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted January 21, 2010 Author Share Posted January 21, 2010 hi why does it need to be wrapped in extra "? Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted January 21, 2010 Share Posted January 21, 2010 It didn't have to be. I could have just as easily removed the two dots (or concatenation operators) surrounding $town If you fully understand strings and string operators, then you'll see why. http://php.he.net/manual/en/language.types.string.php http://php.he.net/manual/en/language.operators.string.php If, after reading those, you are still unsure, come back. Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted January 21, 2010 Author Share Posted January 21, 2010 thanks for the help ill read now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.