Jump to content

[SOLVED] LOAD DATA misinterprets my text?


Recommended Posts

Hi, I'm trying to load some text into a database using LOAD DATA but when it reads a sentence with an apostrophe, the sentence gets cut off. For example:

 

123 , asdf , blah blah blah it's blah ,

 

would read:

 

123 , asdf , blah blah blah it

 

By the way - I'm using the textfield boxes on PHP MyAdmin to import - not MySQL code.

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/78792-solved-load-data-misinterprets-my-text/
Share on other sites

My suggestion is that they're query is in single quotes, thus cutting it of.

Try making your own php script to do this.

 

Also try the LOAD_FILE() function in mysql(root only).

<?php
$query = mysql_query("UPDATE TABLE `table` SET `cell` = LOAD_FILE('data.txt')");
?>

If your going to amend their code then have at look at these functions:

http://uk3.php.net/manual/en/function.addslashes.php

or

http://uk3.php.net/manual/en/function.mysql-escape-string.php

I generally create a wrapper for GET and POST, in it i use one... (read their notes for which in each circumstance)

I solved the problem: There are two types of apostrophes - hard to tell the difference unless you look close. I pasted the text into Microsoft Excel 2007, then deleted the apostrophes and retyped them - it uploaded and appeared without any unexpected line cut-offs or breaks.  ;)

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.