Location: PHPKode > projects > MySQLauction > libphp/allitems.php
<?php
  ######################################################################
  # 
  # In accordance with the GPL, this copyright notice MUST remain
  # intact:
  #
  # MySQLauction Release Version 0.1.0 (021001)
  # Copyright (C) 2002 High Sierra Networks, Inc.
  # http://www.servers-r-us.com
  # hide@address.com
  #
  ######################################################################
  #
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public License
  # as published by the Free Software Foundation; either version 2
  # of the License, or (at your option) any later version.
  # 
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  # 
  # You should have received a copy of the GNU General Public License
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  # MA 02111-1307, USA.
  #
  ######################################################################

  ######################################################################
  #
  # Written by Jorge Gonzalez - Athena Soft, S.A. de C.V.
  # http://www.athenasoft.com.mx
  # hide@address.com
  #
  # Name: allitems.php
  # Date: 021001
  # Purpose:
  # This script displays a list of all items posted, for all categories.
  # Restrictions:
  # None.
  # Change history:
  # 021001 First version.
  ######################################################################

  function allitems() {
    include("auction.conf.php");
    include("$LIBDIR/auction.conf.lang.php");
    include("$LIBDIR/money.php");
    if($link = mysql_connect($DBHOST,$DBUSR,$DBPWRD)){
      mysql_select_db($DBNAME) or die($mysql_error);
      $result = mysql_query("
        SELECT id, name, bprice, dateout, hasthumb, haspic
        FROM item
        ORDER BY name");
      if(mysql_num_rows($result) > 0) {
        while($arow = mysql_fetch_array($result)) {
          $itemid = $arow[id];
          $hbid = money($arow[bprice]);
          $dateout = date($DATEFMT,$arow[dateout]);
          $result2 = mysql_query("
            SELECT bid
            FROM bid
            WHERE itemid='$itemid'
            ORDER BY bid DESC");
          $nbids = mysql_num_rows($result2);
          if($nbids > 0) {
            $aux = mysql_fetch_row($result2);
            $hbid = money($aux[0]);}
          print("
            <TR>
              <TD CLASS=\"itemlist\" ALIGN=\"left\" VALIGN=\"top\">");
          if($arow[hasthumb] == $DBYES && $arow[haspic] == $DBYES) {print("
            <A CLASS=\"itemlist\" HREF=\"item.php?itemid=$arow[id]\"><IMG SRC=\"$PHOTOSWDIR/$arow[id].0\" BORDER=0 WIDTH=120 HEIGHT=80 ALT=\"$L_CLICKP\"></A>");}
          else if($arow[hasthumb] == $DBYES) {print("
            <A CLASS=\"itemlist\" HREF=\"item.php?itemid=$arow[id]\"><IMG SRC=\"$PHOTOSWDIR/$arow[id].0\" BORDER=0 WIDTH=120 HEIGHT=80 ALT=\"$L_CLICKD\"></A>");}
          else if ($arow[haspic] == $DBYES) {print("
            <A CLASS=\"itemlist\" HREF=\"item.php?itemid=$arow[id]\">$L_CLICKP</A>");}
          else {print("
                <BR>");}
          print("
              </TD>
              <TD CLASS=\"itemlist\" ALIGN=\"left\" VALIGN=\"top\">
                <A CLASS=\"itemlist\" HREF=\"item.php?itemid=$arow[id]\">$arow[name]</A>
              </TD>
              <TD CLASS=\"itemlist\" ALIGN=\"right\" VALIGN=\"top\">
                $hbid
              </TD>
              <TD CLASS=\"itemlist\" ALIGN=\"right\" VALIGN=\"top\">
                $nbids
              </TD>
              <TD CLASS=\"itemlist\" ALIGN=\"right\" VALIGN=\"top\">
                $dateout
              </TD>
            </TR>");}
        mysql_close($link);}
      else {
        mysql_close($link);
        print("<TR><TD CLASS=\"itemlist\" COLSPAN=5><FONT CLASS=\"error\">$L_NOITEMS1</TD></TR>");}}
    else {
      die($mysql_error);}}
?>
Return current item: MySQLauction