Hotels Under $50 a Night

Post image for Hotels Under $50 a Night

By traveldesk   

   ADD TO STUMBLEUPON ADD TO DEL.ICIO.US  Add to Mixx! Mixx  Facebook Tweet This

Hotels across the US $50 or less, midweek stays, weekends may be higher.

$db = mysql_connect ("localhost", "wpkath", "kathika01");
mysql_select_db ("wpkath", $db);

//get the distinct state
$query = "select distinct state from blockbusters where country = 'US' and price < 51 order by state";
//execute query
$result = mysql_query($query);

//get the number of results
$num = mysql_num_rows($result);
$numb = intval($num/2);

//set up state abbr conversion
$states = "Alaska,Alabama,Arkansas,Arizona,California,Colorado,Connecticut,Delaware,Florida,Georgia,Hawaii,Iowa,Idaho,Illinois,Indiana,Kansas,Kentucky,Louisiana,Massachusetts,Maryland,Maine,Michigan,Minnesota,Missouri,Mississippi,Montana,North Carolina,North Dakota,Nebraska,New Hampshire,New Jersey,New Mexico,Nevada,New York,Ohio,Oklahoma,Oregon,Pennsylvania,Rhode Island,South Carolina,South Dakota,Tennessee,Texas,Utah,Virginia,Vermont,Washington,Wisconsin,West Virginia,Wyoming";
//list abbreviations
$abb = "AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,N Y,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY";
//create arrays
$states_array = explode(",", $states);
$abb_array = explode(",", $abb);
$sl = range(1,$num);
$sn = range(1,$num);

echo '

    ‘;
    for ($i=0;$i< $num;$i++)
    {
    //step thru the results listing by state and building a table with links
    $row = mysql_fetch_array($result);
    $state = stripslashes($row['state']);
    $sl[$i] = $state;
    for($k=0;$k {
    //echo $abb_array[1];
    if($state == $abb_array[$k]){$state = $states_array[$k];}
    }
    $sn[$i] = $state;

    //echo to screen
    echo "

  • “.$state.”
  • “;

    //if is midpoint new table cell
    if ($i==$numb){echo “

    “;}
    }

    echo “

“;
echo ‘

spacer

‘;

for ($i=0;$i< $num;$i++)
{

$query = "select city,state,prop_name,prop_code,price from blockbusters where country = 'US' and state = '".$sl[$i]."' ";
//$price modifier
$query = $query . " and price < 51 ";
$query = $query . " order by state,city,price";
//echo ($query);
$result = mysql_query($query);
$numb = mysql_num_rows($result);
$cityname = "";
echo '

‘;
for ($k=0;$k< $numb;$k++)
{
//step thru the results listing by state and building a table with links
$row = mysql_fetch_array($result);
$name = stripslashes($row['prop_name']);
$city = stripslashes($row['city']);
$state = stripslashes($row['state']);
$price = stripslashes($row['price']);
$code = stripslashes($row['prop_code']);
echo "

“;
}
echo “

‘.$sn[$i].’  
“;
echo ““;

echo $name . ” ” . $city . “, “.$sn[$i];
echo “

“;
echo “$”.$price .” per night”;
echo “

“;
echo ‘

spacer

‘;
}

?>


Creative Commons License photo credit: cliff1066

Subscribe

FULL RSS or Email  
Share This Post
Delicious
Stumbleupon
Twitter
Digg
Reddit
Facebook
Mixx

Tags:
Categories: Travel Deals

Book Travel Hotels, Airlines, Rental Cars & Cruises

Comments on this entry are closed.