counter der auction

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • counter der auction

    Hallo Leute

    folgendes problem

    wenn ich eine auction lösche wird die anzeige der restlichen auktionen in der kategorie nicht aktuallisiert.

    das ist die Datei zum löschen untaktualisieren der Counter(restlichen Auktinen)

    <?

    include "../includes/config.inc.php";
    include "../includes/messages.inc.php";
    include "../includes/countries.inc.php";

    $username = $name;


    //-- Data check
    if(!$id){
    header("Location: listauctions.php");
    exit;
    }

    if($action)
    {
    if(!$ERR)
    {
    //-- Get category
    $query = "select category from ".$dbfix."_auctions where id='$id'";
    $res__ = mysql_query($query);
    if(!$res__)
    {
    print $ERR_001." $query<BR>".mysql_error();
    exit;
    }
    else
    {
    $cat_id = mysql_result($res__,0,"category");
    }

    //-- delete auction
    $sql="delete from ".$dbfix."_auctions WHERE id='$id'";
    $res=mysql_query ($sql);

    //-- Update counters
    $query = "select auctions from ".$dbfix."_counters";
    $result = mysql_query($query);

    $auctions = mysql_result($result,0,"auctions");
    for($i = 0; $i <= $auctions; $i--) {
    $n -= 1;
    }
    $auctions = $auctions;

    $query = "update ".$dbfix."_counters set auctions=$auctions";
    $result = mysql_query($query);

    // update "categories" table - for counters
    $root_cat = $cat_id;
    do
    {
    // update counter for this category
    $query = "SELECT * FROM ".$dbfix."_categories WHERE cat_id=\"$cat_id\"";
    $result = mysql_query($query);

    if($result)
    {
    if (mysql_num_rows($result)>0)
    {
    $R_parent_id = mysql_result($result,0,"parent_id");
    $R_cat_id = mysql_result($result,0,"cat_id");
    $R_counter = intval(mysql_result($result,0,"counter"));
    $R_sub_counter = intval(mysql_result($result,0,"sub_counter"));

    $R_sub_counter--;
    if ( $cat_id == $root_cat )
    --$R_counter;

    if($R_counter < 0) $R_counter = 0;
    if($R_sub_counter < 0) $R_sub_counter = 0;


    $query = "UPDATE ".$dbfix."_categories SET counter='$R_counter', sub_counter='$R_sub_counter' WHERE cat_id=\"$cat_id\"";
    @mysql_query($query);

    $cat_id = $R_parent_id;
    }
    }
    }
    while ($cat_id!=0);


    Header("location: listauctions.php?offset=$offset");
    }

    }


    if(!$action){

    $query = "select a.id, u.nick, a.title, a.date, a.description,
    c.cat_name, d.description as duration, a.suspended, a.current_bid,
    a.quantity, a.reserve_price, a.location from ".$dbfix."_auctions
    a, ".$dbfix."_users u, ".$dbfix."_categories c, ".$dbfix."_durations d where u.id = a.user and
    c.cat_id = a.category and d.days = a.duration and a.id=\"$id\""; $result = mysql_query($query);
    if(!$result){
    print "Database access error: abnormal termination".mysql_error();
    exit;
    }

    $id = mysql_result($result,0,"id");
    $title = mysql_result($result,0,"title");
    $nick = mysql_result($result,0,"nick");
    $tmp_date = mysql_result($result,0,"date");
    $duration = mysql_result($result,0,"duration");
    $category = mysql_result($result,0,"cat_name");
    $description = mysql_result($result,0,"description");
    $suspended = mysql_result($result,0,"suspended");
    $current_bid = mysql_result($result,0,"current_bid");
    $quantity = mysql_result($result,0,"quantity");
    $reserve_price = mysql_result($result,0,"reserve_price");
    $country = mysql_result($result, 0, "location");

    $country_list="";
    $country_query = "SELECT country_id, country FROM ".$dbfix."_countries ORDER BY country";
    $res_c = mysql_query($country_query);
    if(!$res_c){
    print "Database access error: abnormal termination".mysql_error();
    exit;
    }
    for ($i = 0; $i < mysql_num_rows($res_c); $i++)
    {
    $row = mysql_fetch_row($res_c);
    // Append to the list
    $country_list .= "<option value=\"$row[0]\"";
    if ($row[0] == $country)
    {
    $country_list .= " selected ";
    }
    $country_list .= ">$row[1]</option>\n";
    };

    $day = substr($tmp_date,6,2);
    $month = substr($tmp_date,4,2);
    $year = substr($tmp_date,0,4);
    $date = "$day/$month/$year";
    }

    include "./header.php";
    require('../includes/styles.inc.php');
    ?>
    Gruß Oli

    Webdesign, Programmierung u.v.m. Börner It
    Rss Katalog Verzeichnis. RssKat
    PHP - Scripte, News, Tutorials u.v.m PHP Community Neu
    Günstige PHP Projekte nichts von der Stange Börner IT Shop
Lädt...
X