Jump to content

Stubworth

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Stubworth's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I believe it is now functioning correctly after some testing with various inputs. The code I used to achieve this can be found below: As per Fou-Lu's suggestions (user on CodingForums.com), I multiplied it all by 100 then divided by 100 when entering the information into the DB table which is a decimal(10,2) field. I also followed xyph's advice regarding limiting the 'from' and 'to' strings to 2 decimal places before multiplying them up. if($_POST['bid_type']=='range') { $flag=0; for($j=(number_format($_POST['bid_from'], 2, '.', ' ')*100);($j<(number_format($_POST['bid_to'], 2, '.', ' ')*100)+1);$j+=1.00) { $insert = "INSERT INTO bids(auction, bidder, bid, bidwhen) VALUES($id, $user_id_, $j/100, '$NOW');"; mysql_query($insert); } }
  2. Hi wildteen, thanks for the reply. I changed the code as per your reccomendation with odd results. The bids for £0.01 to £0.10 no longer placed a bid for £0.11 as well and were therefore functioning as intended. However I then entered ranges of £1.30 to £1.40 and £1.40 to £1.50 respectively, both times these entries entered only up to £1.39 and £1.49 respectively. Any further ideas?
  3. Hey all I'm working on an auction website. Users can enter a 'Bid From' and 'Bid To' amount to enter bids in a range. So for instance, you bid from £0.01 to £0.10 you place bids for £0.01, £0.02, £0.03 etc. up to and including £0.10. Now comes the part where I am confused, I have a code snippet which finds the values between the two numbers, enters them into the database perfectly. However, on certain random 'ranges' an additional bid is added onto the end. That is, a bid from £0.01 to £0.10 places bids up to £0.11. This only happens sometimes and there is no discernable pattern in the values affected. Users are charged credits for each bid placed in the auction and the number of credits taken when an extra bid is placed are as they should be, i.e. bidding between £0.01 and £0.10 should cost 10 credits, when values £0.01 to £0.11 are entered in the DB, 10 credits are still charged. This problem is only with the values created and entered into the 'bids' table in the database. The code I am using is as follows: if($_POST['bid_type']=='range') { $flag=0; for($j=$_POST['bid_from'];$j<($_POST['bid_to']+0.01);$j+=0.01) { $insert = "INSERT INTO bids(auction, bidder, bid, bidwhen) VALUES($id, $user_id_, $j, '$NOW');"; mysql_query($insert); } } The most important section is the 'for' statement. The $flag statement is to prevent F5 (refresh) reprocessing the PHP on the page. If anyone has any suggestions or ideas as to why this will on an apparently random occasion and an extra value, please let me know! Thanks in advance for any replies! I'd also be happy to look at alternative methods of achieving this same result if you can think of any! :thumbsup:
  4. Yes. Yes, the following: Warning: include(includes/settings.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 52 Warning: include(includes/settings.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 52 Warning: include() [function.include]: Failed opening 'includes/settings.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 52 Warning: include(includes/messages.EN.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 53 Warning: include(includes/messages.EN.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 53 Warning: include() [function.include]: Failed opening 'includes/messages.EN.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 53 Warning: include(includes/languages.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 54 Warning: include(includes/languages.inc.php) [function.include]: failed to open stream: No such file or directory in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 54 Warning: include() [function.include]: Failed opening 'includes/languages.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wwwuneeq/public_html/admin/includes/config.inc.php on line 54 But bear in mind the above are ONLY when the 'shipped' column is present, normally it functions fine. Also, having re-read them just know I think these may be related to error.php and the errorhandling.php files, rather than the new column. Yes, I added Shipped='No' to both of the UPDATE statements to no effect. ('No' is fine as it is updated from another page) Yes, the column is varchar(3) and set to NULL by default. Thank-you so far!
  5. Please reply if (to the best of your knowledge) this isn't possible as I can try to find a work-around but ideally I'd like to do the above.
  6. Hey all I'm working on an auction website. I've added a new column to the 'Auctions' table, however the 'sell.php' page now does not work with this new column (I've deleted the column and tested again and it works, so that's definitely the cause). The new column can not be in a separate table as it needs to pull 'id' values from the 'Auctions' table for various functions. My question to you is, is there any PHP snippet I can use to tell sell.php to stop reading the 'Auctions' table once it reaches the column I've added? The new column is called 'shipped' if that's of any relevance. Below is some of the PHP I'm working on on the sell.php page. #//Populate arrays $UPLOADED_PICTURES[] = $file; $UPLOADED_PICTURES_SIZE[] = filesize($image_upload_path.session_id()."/".$file); } } } $_SESSION["UPLOADED_PICTURES"] = $UPLOADED_PICTURES; $_SESSION["UPLOADED_PICTURES_SIZE"] = $UPLOADED_PICTURES_SIZE; $_SESSION["GALLERY_UPDATED"]=true; if($sessionVars['SELL_action']=='edit') { $sessionVars["OLD_GALLERYFEE"] = $SETTINGS["picturesgalleryvalue"] * count($UPLOADED_PICTURES); } else { $sessionVars["OLD_GALLERYFEE"] = 0; } } } } $with_reserve = $sessionVars["SELL_with_reserve"]; $reserve_price = $sessionVars["SELL_reserve_price"]; $minimum_bid = $sessionVars["SELL_minimum_bid"]; $duration_hours = $sessionVars["SELL_duration_hours"]; $duration_minutes = $sessionVars["SELL_duration_minutes"]; $pict_url=$sessionVars["SELL_pict_url"]; $imgtype = $sessionVars["SELL_file_uploaded"]; $title = $sessionVars["SELL_title"]; $description = stripslashes($sessionVars["SELL_description"]); $pict_url = $sessionVars["SELL_pict_url"]; $atype = $sessionVars["SELL_atype"]; $adultonly = $sessionVars["SELL_adultonly"]; $TPL_item_value = $item_value = $sessionVars["SELL_item_value"]; $TPL_number_of_bids =$number_of_bids=$sessionVars["SELL_number_of_bids"]; $TPL_bid_value = $bid_value = $sessionVars["SELL_bid_value"]; $iquantity = $sessionVars["SELL_iquantity"]; $buy_now = $sessionVars["SELL_with_buy_now"]; $buy_now_price = $sessionVars["SELL_buy_now_price"]; $duration = $sessionVars["SELL_duration"]; $duration_second = $sessionVars["SELL_duration_second"]; $minimum_users = $sessionVars["SELL_minimum_users"]; $relist = $sessionVars["SELL_relist"]; $increments = $sessionVars["SELL_increments"]; $customincrement = $sessionVars["SELL_customincrement"]; $international = ($sessionVars["SELL_international"])?"on":""; $sellcat = $_SESSION['sellcat']; $private = $sessionVars["SELL_private"]; if($private != 'y') $private = 'n'; $sendemail = $sessionVars["SELL_sendemail"]; $txt = $sessionVars["SELL_txt"]; $num = $sessionVars["SELL_num"]; $buy_now_only = $sessionVars["SELL_buy_now_only"]; and... $auction_id=$sessionVars['SELL_auction_id']; } elseif ($sessionVars["SELL_action"] == "reopen") { $query = "UPDATE BPLA_auctions set title = '".addslashes($sessionVars["SELL_title"])."', starts = '".$a_starts."', starts_second = '".$a_starts_second."', description = '".addslashes($sessionVars["SELL_description"])."', pict_url = '".addslashes($sessionVars["SELL_pict_url"])."', category = ".$sessionVars["SELL_sellcat"].", minimum_bid = '".$sessionVars["SELL_minimum_bid"]."', reserve_price = '".(($sessionVars["SELL_with_reserve"]=="yes")?$sessionVars["SELL_reserve_price"]:"0")."', buy_now = '".(($sessionVars["SELL_with_buy_now"]=="yes")?$sessionVars["SELL_buy_now_price"]:"0")."', bn_only = '".$sessionVars["SELL_buy_now_only"]."', auction_type = '".$sessionVars["SELL_atype"]."', adultonly = '".$sessionVars["SELL_adultonly"]."', duration = '".$sessionVars["SELL_duration"]."', duration_second = '".$sessionVars["SELL_duration_second"]."', minimum_users = ".intval($sessionVars["SELL_minimum_users"]).", increment = ".doubleval($sessionVars["SELL_customincrement"]).", international = '".(($sessionVars["SELL_international"])?"1":"0")."', ends = '".$a_ends."', ends_second = '".$a_ends_second."', photo_uploaded = ".(($sessionVars["SELL_file_uploaded"])?"1":"0").", quantity = ".$sessionVars["SELL_iquantity"].", relist=".intval($sessionVars["SELL_relist"]).", relisted=0, closed='0', private='n', item_value = '".$sessionVars["SELL_item_value"]."', number_of_bids = '".$sessionVars["SELL_number_of_bids"]."', bid_value = '".$sessionVars["SELL_bid_value"]."', suspended='".$SUSPENDED."',"; $query .= "current_bid=0, num_bids=0, WHERE id = '".$sessionVars["SELL_auction_id"]."'"; $backtoclosed=true; if($BPLowbidAuction_TESTMODE == 'yes'){ echo $ERR = $ERR_9999; }else{ $res=mysql_query($query); if (!$res) { MySQLError($query); exit; } $auction_id=$sessionVars['SELL_auction_id']; $sessionVars["SELL_auction_id_old"]=$auction_id; $query = "DELETE FROM BPLA_bids WHERE auction='$auction_id'"; $res = @mysql_query($query); if(!$res) { MySQLError($query); exit; } Thanks in advance for any help and replies!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.