Location: PHPKode > projects > MySQLauction > libphp/item3.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: item3.php
  # Date: 021001
  # Purpose:
  # This script displays an item for sale.
  # Restrictions:
  # None.
  # Change history:
  # 021001 First version.
  ######################################################################

  function item3($id) {
    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, description, bprice, increment
        FROM item
        WHERE id='$id' ");
      if(mysql_num_rows($result) > 0) {
        $arow = mysql_fetch_array($result);
        $itemid = $arow[id];
        $hbid = money($arow[bprice]);
        $yourbid = $arow[bprice];
        $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);
          $yourbid = $aux[0] + $arow[increment];
          $hbid = money($aux[0]);}
        $fyourbid = money($yourbid);
        print("
          <TR>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_ITEM:</TD>
            <TD COLSPAN=3 CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$arow[name]</TD>
          </TR>
          <TR>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_DESCRIPTION:</TD>
            <TD COLSPAN=3 CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$arow[description]</TD>
          </TR>
          <TR>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_BIDS:</TD>
            <TD COLSPAN=3 CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$nbids</TD>
          </TR>
          <TR>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_HBID:</TD>
            <TD COLSPAN=3 CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$hbid</TD>
          </TR>
          <TR>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_YOURBID</TD>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$fyourbid</TD>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">$L_HIGHER:</TD>
            <TD CLASS=\"item\" ALIGN=\"left\" VALIGN=\"top\">
              $<INPUT CLASS=\"item\" NAME=\"yourbid\" VALUE=\"$yourbid\" SIZE=8 MAXLENGTH=8>
              <INPUT TYPE= \"hidden\" NAME=\"minbid\" VALUE=\"$yourbid\">
            </TD>
          </TR>
          <TR>
            <TD COLSPAN=4 CLASS=\"popupremark\" ALIGN=\"left\" VALIGN=\"top\">$L_BINDING</TD>
          </TR>");
        mysql_close($link);}
      else {
        mysql_close($link);
        print("<TR><TD CLASS=\"itemlist\" COLSPAN=5><FONT CLASS=\"error\">$L_NOITEMS</TD></TR>");}}
    else {
      die($mysql_error);}}
?>
Return current item: MySQLauction