websmoken Posted February 5, 2007 Share Posted February 5, 2007 Hi Ya'll Nice forum Please don't hurt me too bad, I'm a newbie with a question. I'm integrating UPS shipping into my shopping cart. I want to add 2 more columns to the company info table. Is it better to add at the end of the table or insert a column? My existing columns (in order) are :comp_ID, comp_Name, comp_Address1, comp_Address2, comp_City, comp_State, comp_Zip, comp_Country, comp_Phone, comp_Fax, comp_Email, comp_ChargeBase, comp_ChargeWeight, comp_ChargeExtension, comp_enableshipping, comp_ShowUpSell, comp_AllowBackOrders. The original query was: if (isset($_POST["update"])){ $query_rsCW = sprintf("UPDATE tbl_companyinfo SET comp_ChargeBase = %s , comp_ChargeWeight = %s , comp_ChargeExtension = %s , comp_enableshipping = %s WHERE comp_ID = %s" ,$_POST["comp_ChargeBase"] ,$_POST["comp_ChargeWeight"] ,$_POST["comp_ChargeExtension"] ,$_POST["comp_EnableShipping"] ,$_POST["comp_ID"]); $rsCW = $cartweaver->db->executeQuery($query_rsCW); /* Reset the application variables */ $_SESSION["ChargeShipBase"] = $_POST["comp_ChargeBase"]; $_SESSION["ChargeShipByWeight"] = $_POST["comp_ChargeWeight"]; $_SESSION["ChargeShipExtension"] = $_POST["comp_ChargeExtension"]; $_SESSION["EnableShipping"] = $_POST["comp_EnableShipping"]; header("Location: " . $cartweaver->thisLocation); exit(); } I added 1 column after comp_ChargeBase and named it comp_RemoteShipBase. After comp_EnableShipping, I added comp_EnableRemoteShipping. I followed through with the session & post in the same order. if (isset($_POST["update"])){ /* added , comp_ChargeRemoteBase = %s, comp_EnableRemoteShipping = %s */ $query_rsCW = sprintf("UPDATE tbl_companyinfo SET comp_ChargeBase = %s , comp_RemoteShipBase = %s , comp_ChargeWeight = %s , comp_ChargeExtension = %s , comp_EnableShipping = %s , comp_EnableRemoteShipping = %s WHERE comp_ID = %s" ,$_POST["comp_ChargeBase"] ,$_POST["comp_RemoteShipBase"] /* added */ ,$_POST["comp_ChargeWeight"] ,$_POST["comp_ChargeExtension"] ,$_POST["comp_EnableShipping"] ,$_POST["comp_EnableRemoteShipping"]/* THIS IS LINE 37 */ ,$_POST["comp_ID"]); $rsCW = $cartweaver->db->executeQuery($query_rsCW); /* Reset the application variables */ $_SESSION["ChargeShipBase"] = $_POST["comp_ChargeBase"]; $_SESSION["RemoteShipBase"] = $_POST["comp_RemoteShipBase"];/* added */ $_SESSION["ChargeShipByWeight"] = $_POST["comp_ChargeWeight"]; $_SESSION["ChargeShipExtension"] = $_POST["comp_ChargeExtension"]; $_SESSION["EnableShipping"] = $_POST["comp_EnableShipping"]; $_SESSION["EnableRemoteShipping"] = $_POST["comp_EnableRemoteShipping"];/*LINE 46 */ header("Location: " . $cartweaver->thisLocation); /*LINE 48*/ exit(); } I am getting error messages that reads. "Notice: Undefined index: comp_enableremoteshipping in C:\wamp\www\cartweaversite\cw2\admin\ShipSettings.php on line 37 Notice: Undefined index: comp_enableremoteshipping in C:\wamp\www\cartweaversite\cw2\admin\ShipSettings.php on line 46 Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\cartweaversite\cw2\admin\ShipSettings.php:37) in C:\wamp\www\cartweaversite\cw2\admin\ShipSettings.php on line 48 Can anybody tell what might be wrong? Tell me if you need more info. Thanks, Dave http://www.websmoken.net/ Quote Link to comment Share on other sites More sharing options...
btherl Posted February 6, 2007 Share Posted February 6, 2007 Can you print out $query_rsCW so we can inspect the syntax? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 6, 2007 Share Posted February 6, 2007 Man, do I ever hate sprintf()... but none of these look like MySQL errors. Quote Link to comment Share on other sites More sharing options...
websmoken Posted February 6, 2007 Author Share Posted February 6, 2007 btherl Are you refering to printf() ? If you are I added it and got: UPDATE tbl_companyinfo SET comp_ChargeBase = 0 , comp_RemoteShipBase = 0 , comp_ChargeWeight = 0 , comp_ChargeExtension = 0 , comp_enableshipping = 1 , comp_enableremoteshipping = WHERE comp_ID = 1 The Only 2 that were enabled at the time was enableshipping & enableremoteshipping. I don't see where enableremoteshipping equals anything. Shouldn't it be 1 as well? ??? Dave Quote Link to comment Share on other sites More sharing options...
fenway Posted February 6, 2007 Share Posted February 6, 2007 Also, they're not quoted.... Quote Link to comment Share on other sites More sharing options...
websmoken Posted February 6, 2007 Author Share Posted February 6, 2007 Thanks for answering so soon. Also, they're not quoted.... Maybe you could elaborate a little more. Remember I'm just a n00bie sorry but I'm tryin. Quote Link to comment Share on other sites More sharing options...
fenway Posted February 6, 2007 Share Posted February 6, 2007 Well, I'm going to guess that there's nothing in the $POST for that hash key... and although you're using integer values, you should still quote your values. Quote Link to comment Share on other sites More sharing options...
websmoken Posted February 6, 2007 Author Share Posted February 6, 2007 This was an original program that works. I'm just adding to it, using what he had as a guide. Don't know why he didn't use quotes. Sorry I took up your time. I'm gonna do somemore reading. Thanks for ya'lls help. Dave Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.