Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mysql insert error

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
HI all, This is not neccisarliy an error, its a problem im faced with and cant understand it.. it could be mysql or it could be the php programming.. but here goes

i have a mysql db set up with one column to be a VARCHAR(255) and a PHP script that places the info into the columns..

Now i am using a CSV file to import data from a excel spreadsheet.

ok.. the script runs fine.. no problems, however

when i check the column in question in the database its unusual

some records have " at the front of them, and are only short.. then what is happening is the rest of the data is being placed into the next column, which in turn is messing up my records.

i have checked the CSV file and the records do not contain a " or two ' i dont understand where its comming from, Also it only appears on certain records, i can find nothing that is the same with the records.. IE something that they all have in commen. but nothing.

any ideas would be appreciated..

Thanks

Keith
 
could you post some lines of the CVS file where you get 1 record with problems?
 
,AARON S DREAM,4.00,5,,TRUE,FALSE,1994,Sutton,Mid-Late,TRUE,TRUE,Pale blue ruffled self with mid blue beards vigorous grower!,FALSE,FALSE,,,,37,Aaron s_Dream jpg,FALSE,BLUE,SELF,TB,,

This is the first line in the code. and it causes the problem, there are also other parts

the section that causes the problem is the bit that starts with

Pale blue ruffled

it generates the following

pdesc = "Pale blue ruffled self with mid blue beards
Spaceage_beard = vigo

note that pdesc and Spaceage_beard are two different columns
both are set to varchar(255)

you see that pdesc has a " which is NOT in the csv file

any help would be appreciated

tahnks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top