Page is a not externally linkable
- WebmasterWorld
-- New To Web Development
---- Output Listing


Ollie_3rd - 11:30 pm on Dec 29, 2009 (gmt 0)


Ignore post above. Been trying figure it out on my own and have gotten this far but can't figure out what's wrong. Hope you help!

------------Latest output and coding------------------

State Listings

Alabama Beekeepers Association
Baldwin County Beekeepers Association
Central Alabama Beekeepers Association
Choctaw County Beekeepers Association
Cullman County Beekeepers Association
East Alabama Beekeepers Association
Escambia County Beekeepers Association
Etowah County Beekeepers Association
Jefferson County Beekeepers Association
Limestone County Beekeepers Association
Madison County Beekeepers Association
Monroe County Beekeepers Association
North-East Alabama Beekeepers Association
North-West Alabama Bee Club
Sand Mountain Beekeepers Association
Saugahatchee Beekeekers Association
South-East Alabama Beekeepers Association
Tallapoosa River Beekeepers Association
Tennessee Valley Beekeepers Association
Walker County Beekeepers Association
West Alabama Beekeepers Association
Wiregrass Beekeepers Association
No results in ALABAMA

ALABAMA

Alaska Beekeepers Association
No results in ALABAMA

ALABAMA

No results in ALASKA

ALASKA

Beekeepers Association of Central Arizona
No results in ALABAMA

ALABAMA

No results in ALASKA

ALASKA

No results in ARIZONA

ARIZONA

Arkansas Beekeepers Association
No results in ALABAMA

ALABAMA

No results in ALASKA

ALASKA

No results in ARIZONA

ARIZONA

No results in ARKANSAS

ARKANSAS
----------------------------latest coding-----------------------
<html>
<head>
<title>Anne Arundel Beekeepers Association</title>
<META NAME="Listing of US Beekeeping Organizations" CONTENT="Links to Beekeeping Web Sites">
<META NAME="Bee,Bees,Beekeeping,Honey,Web Sites,Queen,Drone,Worker" CONTENT="PHP code to retreive data from a MySql Database">
</head>
<body>

<h1>State Listings</h1>

<?php
mysql_connect("localhost", "root") or die(mysql_error());

//echo "Connected to MySQL<br />";

mysql_select_db("test") or die(mysql_error());

//echo "Connected to Database<p>";

$allstates = Array (
'ALABAMA',
'ALASKA',
'ARIZONA',
'ARKANSAS',
'blank',
// And so on, full state list.
);

$currState=$rowData=NULL;

foreach ($allstates as $state)
{

if ($currState != $state)

{

$output .= "<h3>$currState</h3>";

$currState=$state; // only prints once per section
}

echo "$output";

$query = "SELECT web, name FROM aaba WHERE state = '$state' ORDER BY name ASC";

$result=mysql_query($query);
if (!$result)

{ die("can't get data from tablename: " . mysql_error());

} while ($row=mysql_fetch_array($result))

{

//$row[0] is web, $row[1] is name. You can also use
//assoc. values: $row['web'] and $row['name']

echo " $row[0] <br />";

}
if ($rowData)

{ $output .= $rowData;

}
else

{ $output .= "No results in $state<br />";

}

}

mysql_free_result($result);

?>

</BODY>
</html>


Thread source:: http://www.webmasterworld.com/new_web_development/4050287.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com