HELP - SQL results are not displaying

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 Profit     

PHP:

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

The purpose of like is to allow users to type in partial search queries.
So bra will find cowabralah etc so use % as a wild card

[php]<?php
mysql_connect(“localhost”, “######”, “########”) or die("Error Connecting to Database: ".mysql_error());
mysql_select_db(“connecte_wor1”) or die(mysql_error());

$state = htmlspecialchars($_POST[‘State’]);
$sector = htmlspecialchars($_POST[‘Sector’]);
$institutionalsize = htmlspecialchars($_POST[‘Institutional_Size’]);
$collegetype = htmlspecialchars($_POST[‘College_Type’]);

$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 "<p>".$results['INSTNM']."".$results['ADDR']."".$results['STABBR']."</p>";
}

}else{
echo “No Results”;
}

?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service