Hallo!
Ich bitte um Hilfe bei einer Code-Mod.
Es geht um ein Fanlisting.
Es gibt ein "Join" Formular mit Angaben über Land, Staat/Region, Stadt und Memberangaben (wie url, @, ...).
Zu diesen Angaben gibt es eine MySQL Tabelle.
Bei den original Codes gibt es keine Angaben über Staat/Region oder Stadt.
Daher werden dort die Mitglieder nur nach Ländern sortiert und gezählt.
Ich möchte aber folgendes:
* Alle Länder (alphabetisch geordnet) und
die Fananzahl daneben.
* wenn man auf das Land klickt sollen alle Regionen/Staaten mit
der Fananzahl der/s jeweiligen Region/Staates aufscheinen
* wenn man auf eine/n Region/Staat klickt sollen die Städte dieser Region mit
der Fananzahl daneben aufscheinen
* wenn man auf eine Stadt klickt sollen die Member dieser Stadt aufscheinen, mit url, @, Geburtsjahr, m/w, ...;
Nachstehend nun die ORIGINAL CODES :
COUNTRY CODE (Dieser code bewirkt, dass wenn man auf's Land klickt kommen die Members dieses einen Landes =
Australia 2 members
ID Name Email URL
[067] becky lorraine @ www
[062] Kassandra @ www )
code:
---------------------------------------------------------------------
<?
<?
include("config.php");
include("$header");
$query="SELECT * FROM $table WHERE apr='y' AND country='$id' ORDER BY $countrysort ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<h2>
<?
if ($num == "1"){
echo "$num Member";
} else {
echo "$num Members";
} ?> from <?=$id?></h2>
<p>See also the <a href="members.php?id=all">complete list</a> or <a href="members.php">browse by country</a>.</p>
<div align="center"><table border="0" cellspacing="0" cellpadding="5">
<tr>
<td><strong>ID</strong></td>
<td><strong>Name</strong></td>
<td><strong>Email</strong></td>
<td><strong>URL</strong></td>
</tr>
<?
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"name");
$email=mysql_result($result,$i,"email");
$url=mysql_result($result,$i,"url");
$hide=mysql_result($result,$i,"hideemail");
$id = sprintf("%03.0f", $id);
echo "<td>[$id]</td>
<td>$name</td>";
if ($hide != "h"){
$array = explode("@", $email);
$first = $array[0];
$last = $array[1];?>
<td><SCRIPT TYPE="text/javascript">
emailE=('<?=$first?>' + '@' + '<?=$last?>')
document.write(
'<A HREF="mailto:' + emailE + '">'
+ '@' +'</a>'
)
</SCRIPT></td>
<? } else {
echo "<td><s>@</s></td>"; }
if ($url == "") {
echo "<td><s>www</s></td>";
} elseif ($url !== "") {
echo "<td><a href="$url" target="_blank">www</a></td>"; }
{ echo "</tr>"; }
++$i;
}
echo "</table></div>";
include("$footer");
?>
---------------------------------------------------------------------
MEMBER CODE (enthält: Fananzahl pro Land =
Country Fans
Australia 3 fans
Belgium 1 fan
und Auflistung der Fannamen, urls usw. nach Ländern sortiert =
ID Name Email URL Country
[019] Alicia @ www USA
[036] Ally @ www Canada
[040] Alyssia @ www Switzerland )
code:
---------------------------------------------------------------------
<?
<?
include("config.php");
include("$header");
if ($id == 'all'){
$query="SELECT * FROM $table WHERE apr='y' ORDER BY $allsort ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<h2><?=$num?> Members</h2>
<p>The complete list (view <a href="members.php">sorted by country</a>):</p>
<div align="center"><table border="0" cellspacing="0" cellpadding="5">
<tr>
<td><strong>ID</strong></td>
<td><strong>Name</strong></td>
<td><strong>Email</strong></td>
<td><strong>URL</strong></td>
<td><strong>Country</strong></td>
</tr>
<?
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"name");
$email=mysql_result($result,$i,"email");
$url=mysql_result($result,$i,"url");
$country=mysql_result($result,$i,"country");
$hide=mysql_result($result,$i,"hideemail");
$id = sprintf("%03.0f", $id);
echo "<td>[$id]</td>
<td>$name</td>";
if ($hide != "h"){
$array = explode("@", $email);
$first = $array[0];
$last = $array[1];?>
<td><SCRIPT TYPE="text/javascript">
emailE=('<?=$first?>' + '@' + '<?=$last?>')
document.write(
'<A HREF="mailto:' + emailE + '">'
+ '@' +'</a>'
)
</SCRIPT></td>
<? } else {
echo "<td><s>@</s></td>"; }
if ($url == "") {
echo "<td><s>www</s></td>";
} elseif ($url !== "") {
echo "<td><a href="$url" target="_blank">www</a></td>"; }
echo "<td>$country</td>";
{ echo "</tr>"; }
++$i;
}
echo "</table></div>"; ?>
<div align="center"><p>Powered by <a href="http://nothing-less.net/Nothing/you/script_fanbase.php" target="_blank">PHPFanBase</a> 2.0</p></div>
<? } else {
$query="SELECT DISTINCT country FROM $table WHERE apr='y' ORDER BY country ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<h2><?=$num?> Countries</h2>
<p>Here you can view the members sorted by country (click <a href="members.php?id=all">here</a> to view the whole list). Click on the country name to see the members from that country.</p>
<div align="center"><table border="0" cellspacing="0" cellpadding="5">
<tr>
<td><strong>Country</strong></td>
<td><strong>Fans</strong></td></tr>
<?
$i=0;
while ($i < $num) {
$country=mysql_result($result,$i,"country");
$query2="SELECT id FROM $table WHERE apr='y' AND country='$country'";
$result2=mysql_query($query2);
$num2=mysql_numrows($result2);
echo "<td><a href="country.php?id=$country">$country</a></td>";
if ($num2 == "1"){
echo "<td>$num2 fan</td></tr>";
} else {
echo "<td>$num2 fans</td></tr>";
}
++$i;
}
echo "</table></div>";}
include("$footer");
?>
---------------------------------------------------------------------
Wie muss man die "Variablen" (Land, Staat/Region, Stadt, Member) änderen oder einsetzen, damit der Code meinen Anforderungen entspricht?
Es gibt zusätzlich noch ein config.php, wo folgendes festgelegt wird:
//How would you like to have the members sorted on the All and Country pages?
$allsort ="country"; // choose either id, name or country
$countrysort ="name"; //choose either id or name
Wie müsste das in meinem Fall aussehen? So vielleicht:
$allsort ="city";
$citysort ="state_or_region:";
$state_or_regionsort ="country";
$countrysort ="id";