yangkai9999 Posted January 8, 2010 Report Share Posted January 8, 2010 Hello,this is the part of my PHP code. the goal of the code are delete all existing records from p3_new table and load the new records into the table.the problem is: the delete part works well, but the load part isn't.Could you please point out where is the problem and how to fix it?Thank you,code://delete all records from p3_new;$deleterecords = "TRUNCATE TABLE p3_new"; mysql_query($deleterecords);//load new records into p3_new table;$LOADD= "LOAD DATA LOCAL INFILE \"C:\\wamp\\www\\MyTest2\\ex_file\\$csvfile\" INTO TABLE mytest.p3_newFIELDS TERMINATED BY \",\" ENCLOSED BY '\"' ESCAPED BY \"\\\" LINES TERMINATED BY \"\r\n\"IGNORE 1 LINES (study_id,family_id,date_visit,wbc,hgb_g_dl,hct_pctg,plt,na,k,cl,co2,Glucose,bun,cr,gfr,hdl,ldl,chol,trigl,hga1c,ma_cr,Comments);";//echo "$LOADD";mysql_query($LOADD); Link to comment Share on other sites More sharing options...
Mencarta Posted January 9, 2010 Report Share Posted January 9, 2010 Try using INSERT. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 10, 2010 Report Share Posted January 10, 2010 Are you getting any errors? What happens when you run the query? What does the query look like when you print it? You may need to escape the slashes for the terminator. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now