Hi Profis,
irgendwo in meinem Script habe ich einen Fehler, ich finde ihn aber nicht.
Das Script läüft unter
http://www.firmen-park.de
Wenn ich eine Kategorie auf der Hauptseite anklicken, wird sie richtig dargestellt, bis auf die erste Kategorie (Baden-Württemberg). Diese ist nämlich leer, bzw wird als leer angezeigt. Es sind jedoch die gleichen Unterkategorien drin, wie in den anderen Kategorien auch.
Ich nehme mal an, dass der Array-Zeiger in der falschen Position zu Beginn ist, kann jedoch keinen Fehler entdecken.
Quellcode:
$firstrowonpage = $_GET["offset"] + 1;
$totalpages = intval($all_links / $perpage);
if ($all_links%$perpage) {
$totalpages++;
}
if ($totalpages <1){
$totalpages++;
}
$nav = page_num("search.php",$_GET['id'], $all_links, $perpage, $pagenum, $_GET['offset'],$_GET["id"],$_GET["catid"],$subid,$anyword);
$reclinks = getreclinks($_GET["id"]);
if (empty($catfatherid) AND !isset($catfatherid)){
$catfatherid = $_GET['id'];
}
$catsql = "select catid,catname,total from $cat_tbl where catfatherid = '{$catfatherid}'";
$getCats = mysql_query($catsql) or die("error: ".mysql_error());
$catlinks = mysql_num_rows($getCats);
$catrows = " <tr>\n";
$c=0;
for($i=0; $i<$catlinks; $i++){
$categories = mysql_fetch_array($getCats);
$catrows .= " <td style=\"width:16px; text-align:right;\"><img style=\"vertical-align:middle\" src=\"images/arrow.gif\" width=\"9\" height=\"5\" alt=\"\" title=\"\" /></td>\n";
$catrows .= " <td style=\"width:250px; text-align:left\" class=\"greenbold\"> <span class=\"greenbold\"><a class=\"greenbold\" href=\"search.php?id={$categories['catid']}\">{$categories['catname']}</a></span>";
if($categories['total'] > 0){
$catrows .= " <span class=\"greytext\">({$categories['total']})</span>";
}
$catrows .= "<br /></td>\n";
if ($c == 2){
$catrows .=" </tr>\n";
if ($i+1<$catlinks){
$catrows .= " <tr>\n";
}
$c=0;
} else {
$c++;
}
}
eval("\$category = \"".gettemplate("templates/search_categories")."\";");
echo $category;
$color = "#FCFFE4";
if ($num_links){
$listing = "";
for ($i=0; $i<$num_links; $i++){
$stars = '';
$row = mysql_fetch_array($sql_result);
$siteid = $row["siteid"];
$sitetitle = $row["sitetitle"];
$sitehits = $row["sitehits"];
$color = ($color == "#FCFFE4")?"#FFFFFF":"#FCFFE4";
$ratesql = mysql_query("select AVG(rating) AS Rating_Average,COUNT(id) AS TotalRatings from $rating_tbl where rating_id = '$siteid'");
$rate = mysql_fetch_array($ratesql);
if($rate['Rating_Average'] > 0){
$numerofratings = $rate['TotalRatings'];
$average = sprintf("%01.0f", $rate['Rating_Average']);
} else {
$numerofratings = 0;
$average = 0;
}
if ($average > 0){
for($x=0; $x<$average; $x++){
$stars .= "<td><img src=\"images/star_full.gif\" width=\"13\" height=\"13\" alt=\"Full Star\" title=\"Full Star\" /></td>";
}
if(5 -$average >0){
$leftover = 5 -$average;
for($x=0; $x<$leftover; $x++){
$stars .= "<td><img src=\"images/star_empty.gif\" width=\"13\" height=\"13\" alt=\"Empty Star\" title=\"Empty Star\" /></td>";
}
}
} else {
for($x=0; $x<5; $x++){
$stars .= "<td><img src=\"images/star_empty.gif\" width=\"13\" height=\"13\" alt=\"Empty Star\" title=\"Empty Star\" /></td>";
}
}
// end total rating
if(!$row["updatetime"]){
$siteupdate = "<strong>Added:</strong> ".date("D M j Y", $row["sitedate"]);
} else {
$siteupdate = "<strong>Updated: </strong>".date("D M j Y", $row["updatetime"]);
}
if (!empty($row['sponsor'])){
$SponsorImage = "<span class=\"redtext\">SPONSORED</span>";
$curl = "spclick.php?sid=$siteid";
} else {
$SponsorImage = "";
$curl = "click.php?sid=$siteid";
}
$catname = $row["catname"];
$url = "details.php?sid=$siteid";
$descr = $row["sitedescription"];
eval("\$listing .= \"".gettemplate("templates/searchlisting")."\";");
}
// End fetch
} else {
$listing = "<tr><td><div class=\"error\">$NoItemsToDisplay</div></td></tr>\n";
}
eval("\$listing .= \"".gettemplate("templates/mainsearch_end")."\";");
echo $listing;
Jemand eine Idee?
irgendwo in meinem Script habe ich einen Fehler, ich finde ihn aber nicht.
Das Script läüft unter
http://www.firmen-park.de
Wenn ich eine Kategorie auf der Hauptseite anklicken, wird sie richtig dargestellt, bis auf die erste Kategorie (Baden-Württemberg). Diese ist nämlich leer, bzw wird als leer angezeigt. Es sind jedoch die gleichen Unterkategorien drin, wie in den anderen Kategorien auch.
Ich nehme mal an, dass der Array-Zeiger in der falschen Position zu Beginn ist, kann jedoch keinen Fehler entdecken.
Quellcode:
$firstrowonpage = $_GET["offset"] + 1;
$totalpages = intval($all_links / $perpage);
if ($all_links%$perpage) {
$totalpages++;
}
if ($totalpages <1){
$totalpages++;
}
$nav = page_num("search.php",$_GET['id'], $all_links, $perpage, $pagenum, $_GET['offset'],$_GET["id"],$_GET["catid"],$subid,$anyword);
$reclinks = getreclinks($_GET["id"]);
if (empty($catfatherid) AND !isset($catfatherid)){
$catfatherid = $_GET['id'];
}
$catsql = "select catid,catname,total from $cat_tbl where catfatherid = '{$catfatherid}'";
$getCats = mysql_query($catsql) or die("error: ".mysql_error());
$catlinks = mysql_num_rows($getCats);
$catrows = " <tr>\n";
$c=0;
for($i=0; $i<$catlinks; $i++){
$categories = mysql_fetch_array($getCats);
$catrows .= " <td style=\"width:16px; text-align:right;\"><img style=\"vertical-align:middle\" src=\"images/arrow.gif\" width=\"9\" height=\"5\" alt=\"\" title=\"\" /></td>\n";
$catrows .= " <td style=\"width:250px; text-align:left\" class=\"greenbold\"> <span class=\"greenbold\"><a class=\"greenbold\" href=\"search.php?id={$categories['catid']}\">{$categories['catname']}</a></span>";
if($categories['total'] > 0){
$catrows .= " <span class=\"greytext\">({$categories['total']})</span>";
}
$catrows .= "<br /></td>\n";
if ($c == 2){
$catrows .=" </tr>\n";
if ($i+1<$catlinks){
$catrows .= " <tr>\n";
}
$c=0;
} else {
$c++;
}
}
eval("\$category = \"".gettemplate("templates/search_categories")."\";");
echo $category;
$color = "#FCFFE4";
if ($num_links){
$listing = "";
for ($i=0; $i<$num_links; $i++){
$stars = '';
$row = mysql_fetch_array($sql_result);
$siteid = $row["siteid"];
$sitetitle = $row["sitetitle"];
$sitehits = $row["sitehits"];
$color = ($color == "#FCFFE4")?"#FFFFFF":"#FCFFE4";
$ratesql = mysql_query("select AVG(rating) AS Rating_Average,COUNT(id) AS TotalRatings from $rating_tbl where rating_id = '$siteid'");
$rate = mysql_fetch_array($ratesql);
if($rate['Rating_Average'] > 0){
$numerofratings = $rate['TotalRatings'];
$average = sprintf("%01.0f", $rate['Rating_Average']);
} else {
$numerofratings = 0;
$average = 0;
}
if ($average > 0){
for($x=0; $x<$average; $x++){
$stars .= "<td><img src=\"images/star_full.gif\" width=\"13\" height=\"13\" alt=\"Full Star\" title=\"Full Star\" /></td>";
}
if(5 -$average >0){
$leftover = 5 -$average;
for($x=0; $x<$leftover; $x++){
$stars .= "<td><img src=\"images/star_empty.gif\" width=\"13\" height=\"13\" alt=\"Empty Star\" title=\"Empty Star\" /></td>";
}
}
} else {
for($x=0; $x<5; $x++){
$stars .= "<td><img src=\"images/star_empty.gif\" width=\"13\" height=\"13\" alt=\"Empty Star\" title=\"Empty Star\" /></td>";
}
}
// end total rating
if(!$row["updatetime"]){
$siteupdate = "<strong>Added:</strong> ".date("D M j Y", $row["sitedate"]);
} else {
$siteupdate = "<strong>Updated: </strong>".date("D M j Y", $row["updatetime"]);
}
if (!empty($row['sponsor'])){
$SponsorImage = "<span class=\"redtext\">SPONSORED</span>";
$curl = "spclick.php?sid=$siteid";
} else {
$SponsorImage = "";
$curl = "click.php?sid=$siteid";
}
$catname = $row["catname"];
$url = "details.php?sid=$siteid";
$descr = $row["sitedescription"];
eval("\$listing .= \"".gettemplate("templates/searchlisting")."\";");
}
// End fetch
} else {
$listing = "<tr><td><div class=\"error\">$NoItemsToDisplay</div></td></tr>\n";
}
eval("\$listing .= \"".gettemplate("templates/mainsearch_end")."\";");
echo $listing;
Jemand eine Idee?
Kommentar