david.brown Posted May 31, 2010 Share Posted May 31, 2010 Hey Everyone - Have programed up my website on my localhost WAMP server. Workes great! Tryed to migrate it onto the hosting server with limited luck. So what I have is a java program generating the INSERT into statments. (excel to sql tool I made) and the online server is adding \' to all my ' The thing is I have already handled this im the java program I built. My INSERT INTO statment is like this - (please rember that this works well on WAMP php v5.3.0 but not be hosting proivder php v4.2.3 Please dont look into the code too much - I know there are no mistakes in the orignal bu I had to change alot as im asking of help Code: INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-123', 'Patrick', 'James', 'BlueCastle Co. Dublin', 'Dublin', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '08732432432', '', 'Unit', 'Tdsfds', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('SABC-124', 'kenneth', 'James', 'example', 'example', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '0879005196', '0823432403', 'Unit', 'LK0dsf', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-125', 'Annemarie', 'James', 'example', 'example', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '061383657', '08234234236', 'Unit', 'dsfds0', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-126', 'James', 'O\'Regan', 'example', 'Limerick', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '0868128989', '', 'Unit', 'LKdsf60', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-127', 'Colm', 'James', 'example', 'x-number', ''y-numberr', 'Fault', '2010-05-31', 'no', '0868074944', '', 'External Antenna', 'CKdsfds', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-128', 'James', 'SLATER', 'example', 'Mayo', 'x-number', ''y-number', 'Fault', '2010-05-31', 'no', '0832543243', '', 'Unit', 'MY0045', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-129', 'Linda', 'James', 'example', 'Mayo', 'x-number', ''y-number', 'Fault', '2010-05-31', 'no', '09624234324', '0234324230', 'Unit', 'MY0027', 'Broadband', 'no', '1'); On my server - WAMP this is what is queryed! Code: INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-123', 'Patrick', 'James', 'BlueCastle Co. Dublin', 'Dublin', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '08732432432', '', 'Unit', 'Tdsfds', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('SABC-124', 'kenneth', 'James', 'example', 'example', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '0879005196', '0823432403', 'Unit', 'LK0dsf', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-125', 'Annemarie', 'James', 'example', 'example', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '061383657', '08234234236', 'Unit', 'dsfds0', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-126', 'James', 'O\'Regan', 'example', 'Limerick', 'x-number', 'y-number', 'Fault', '2010-05-31', 'no', '0868128989', '', 'Unit', 'LKdsf60', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-127', 'Colm', 'James', 'example', 'x-number', ''y-numberr', 'Fault', '2010-05-31', 'no', '0868074944', '', 'External Antenna', 'CKdsfds', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-128', 'James', 'SLATER', 'example', 'Mayo', 'x-number', ''y-number', 'Fault', '2010-05-31', 'no', '0832543243', '', 'Unit', 'MY0045', 'Broadband', 'no', '1'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES ('ABC-129', 'Linda', 'James', 'example', 'Mayo', 'x-number', ''y-number', 'Fault', '2010-05-31', 'no', '09624234324', '0234324230', 'Unit', 'MY0027', 'Broadband', 'no', '1'); That works Fine- This one is from my hosting proveder. Code: INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-123\', \'Patrick\', \'James\', \'BlueCastle Co. Dublin\', \'Dublin\', \'x-number\', \'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'08732432432\', \'\', \'Unit\', \'Tdsfds\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'SABC-124\', \'kenneth\', \'James\', \'example\', \'example\', \'x-number\', \'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'0879005196\', \'0823432403\', \'Unit\', \'LK0dsf\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-125\', \'Annemarie\', \'James\', \'example\', \'example\', \'x-number\', \'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'061383657\', \'08234234236\', \'Unit\', \'dsfds0\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-126\', \'James\', \'O\\\'Regan\', \'example\', \'Limerick\', \'x-number\', \'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'0868128989\', \'\', \'Unit\', \'LKdsf60\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-127\', \'Colm\', \'James\', \'example\', \'x-number\', \'\'y-numberr\', \'Fault\', \'2010-05-31\', \'no\', \'0868074944\', \'\', \'External Antenna\', \'CKdsfds\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-128\', \'James\', \'SLATER\', \'example\', \'Mayo\', \'x-number\', \'\'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'0832543243\', \'\', \'Unit\', \'MY0045\', \'Broadband\', \'no\', \'1\'); INSERT INTO customer (j_id, FName, LName, address, county, xCoord, yCoord, customer_priorty, SLA_commencement_date, case_closed, phoneNumber1, phoneNumber2, network_recommendation, nominal, original_tariff, isExpanded, stage) VALUES (\'ABC-129\', \'Linda\', \'James\', \'example\', \'Mayo\', \'x-number\', \'\'y-number\', \'Fault\', \'2010-05-31\', \'no\', \'09624234324\', \'0234324230\', \'Unit\', \'MY0027\', \'Broadband\', \'no\', \'1\'); See my problem? Its exactly the same code just run on diffrent servers. I have access the the php.ini on the hosting provider if it needs changing. PLEASE HELP!! Thanks everyone in advanced! Regards Dave ps. Code on request - just ask! Quote Link to comment https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2010 Share Posted May 31, 2010 You are apparently reading the sql from a file. See this link - http://us2.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime Quote Link to comment https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/#findComment-1065532 Share on other sites More sharing options...
david.brown Posted May 31, 2010 Author Share Posted May 31, 2010 Yea I am - I am pasting mutilate INSERT INTO query's into a text box then using explode to break up the query. I posted below the code please help me with the code if possible. $insert_query = $_REQUEST['insert']; // This may contain upto 50 INSERT statements. $i = 0; if($insert_query != NULL){ $insert_query = explode("');", $insert_query); } // echo ($insert_query[0]); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for ($i = 0; $i < sizeof($insert_query) - 1; $i++) { $insert = $insert_query[$i]."');"; $result = mysql_query($insert); //echo ($insert); } Quote Link to comment https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/#findComment-1065536 Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2010 Share Posted May 31, 2010 I am pasting mutilate INSERT INTO query's into a text box Then see this link instead - http://us2.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc Quote Link to comment https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/#findComment-1065537 Share on other sites More sharing options...
david.brown Posted May 31, 2010 Author Share Posted May 31, 2010 Thanks that helped amazing! Ive sorted it - I turned off stupid magic quotes! Quote Link to comment https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/#findComment-1065542 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.