I have been working on this for a week now as I teach myself coding. I am finally throwing in the towel and asking for HELP!
I am trying to submit a form and display the results from my sql query but I am only get that No Results were found. It is probably something simple but why does it not return any query results. Thank you!
FORM:
Untitled 1 Ohio Penn New York 1 2 3 Large medium small Public Private For ProfitPHP:
<?php mysql_connect("localhost", "######", "########") or die("Error Connecting to Database: ".mysql_error()); mysql_select_db("connecte_wor1") or die(mysql_error()); $state = $_POST['State']; $sector = $_POST['Sector']; $institutionalsize = $_POST['Institutional_Size']; $collegetype = $_POST['College_Type']; $state = htmlspecialchars($state); $sector = htmlspecialchars($sector); $institutionalsize = htmlspecialchars($institutionalsize); $collegetype = htmlspecialchars($collegetype); $state = mysql_real_escape_string($state); $sector = mysql_real_escape_string($sector); $institutionalsize = mysql_real_escape_string($institutionalsize); $collegetype = mysql_real_escape_string($collegetype); $raw_results = mysql_query("SELECT * FROM hd2012 WHERE ('STABBR' LIKE '".$state."') AND ('SECTOR' LIKE '".$sector."') AND ('INSTSIZE' LIKE '".$institutionalsize."') AND ('LOCALE' LIKE '".$collegetype."')") or die(mysql_error()); if(mysql_num_rows($raw_results) > 0){ while($results = mysql_fetch_array($raw_results)){ echo "".$results['INSTNM']."".$results['ADDR']."".$results['STABBR']."
"; } } else{ echo "No Results"; } ?>