That doesnt work either.
SInce I cannot post attachements, I will post the whole code and hope it fits.
Code: Select all
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Distrobution</title>
<link href="/umm.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
//Declare what happens is there is no Country Selected.
if ( $cntry == '' )
{
echo "Please select a country<br><p>";
}
//Declair valused for Order and Sort if none exist
$order = 'age';
$ascdesc = 'ASC';
//Place Country Selection at top
echo "<a href='?cntry=US'>U.S. distribution channels</a> - <a href='?cntry=CA'>Canadian distribution channels</a>\n";
// Connecting, selecting database
$link = mysql_connect('localhost', 'username', 'password') // Username and Password removed for security purposes
or die('Could not connect: ' . mysql_error());
mysql_select_db('database') or die('Could not select database'); // Database name removed for security purposes
// Printing results in HTML
echo "<table bgcolor='#CCCCCC' width=600>\n";
//Header
if ( $cntry )
{
if ( $cntry == 'US' )
{
echo "<tr><td bgcolor='#000000'><font color='#FFFFFF'><b> U.S. Channels </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Age </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Locations </b></font></td>";
echo "<td bgcolor='#000000'><font color='#FFFFFF'><b> Reach </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Timing </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Gender </b></font></td></tr>\n";
} else {
echo "<tr><td bgcolor='#000000'><font color='#FFFFFF'><b> Canadian Channels </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Age </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Locations </b></font></b></font></td>";
echo "<td bgcolor='#000000'><font color='#FFFFFF'><b> Reach </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Timing </b></font></td><td bgcolor='#000000'><font color='#FFFFFF'><b> Gender </b></font></td></tr>\n";
}
}
if ( $cntry )
{
// Students
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '1' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Students </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
//Fitness / Sporting
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '2' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Fitness / sporting </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
//Resort/Hotel/Camping
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '3' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Resort / hotel / camping </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
//Community
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '4' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Community </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
// Entertainment
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '5' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Entertainment </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
//Retail/Commercial
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '6' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Retail / commercial </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
// Free resultset
mysql_free_result($result);
//Personal/Medical Care
// Performing SQL query
$query = "SELECT channel,age,locations,reach,timing,gender FROM distribution WHERE cat = '7' && country = '$cntry' ORDER BY $order $ascdesc";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<tr><td colspan=7 bgcolor='#404041'><font color='#FFFFFF'><b> Personal / medical care </b></font></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td bgcolor='#FFFFFF'>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
mysql_free_result($result);
}
// Closing connection
mysql_close($link);
?>
</body>
</html>
Like I said, this exact document used to work just fine till I reformated my system, which means it could possible be a setting in PHP. If I assign a value to $cntry I get the right infor, but I cannot get ti to work at all like this.