Jump to content

my INSERT query is auto adding \'


david.brown

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/203397-my-insert-query-is-auto-adding/
Share on other sites

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);

}

Archived

This topic is now archived and is closed to further 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.