Jump to content

New column in MySQL table breaking page!


Stubworth

Recommended Posts

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!  :D

Link to comment
Share on other sites

IF you add the column to the table BUT do not use it, does it still 'crash'?

 

Yes.

 

do you get error messages?

 

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.

 

When you added the new column did you add the extra input code into the sql statement i.e...

 

Yes, I added Shipped='No' to both of the UPDATE statements to no effect. ('No' is fine as it is updated from another page)

 

, and if not did you ensure that the field value for shipped in the table was set to null to allow a null input?

 

Yes, the column is varchar(3) and set to NULL by default.

 

Thank-you so far!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.