Jump to content


  • Posts

  • Joined

  • Last visited

yangkai9999's Achievements


Newbie (1/7)



  1. Hello,I can run the command from terminal say:mysql -u abc -p12345678 < myscrip1.txtand thenmysql -u abc -p12345678 < myscrip2.txtthe question is: if I save the command as a file, how can I run it at linux terminal?thanks,
  2. 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);
  3. Hello,With many help from yours, I can browse the mysql table data using PHP.Now, I need to add a function to look detail data from browse results by click a link from rows.Can you give me any idea or a short example for that?Thank you,dd sf
  4. Hello,here is my LOAD statement, but it seems doesn't work.the MySQL keep give me a '> prompt. Where is the problem?LOAD DATA LOCAL INFILE 'C:\wamp\www\MyTest2\upload\second.csv' INTO TABLE mytest.p3_new FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\' LINES TERMINATED BY ' ' 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); thank you,
  5. hello,I had the following page link in PHP code. It works fine on my localhost server. If I contact it from other computer, the page link doesn't work and report 404 error. Where is(are) wrong about the code and how to change it?Thank you,code: $cxn = @mysql_connect($current_host,$logon_user,$logon_user_password,$db_chosen ); if (!$cxn) { header('Location: //localhost/index_mytest2_err.php') ; } else { header('Location: //localhost/mytest2/index.html') ; }
  6. But how to solve the problem?Thank you,
  7. Hello,I had a PHP code say:$target = "c:\wamp\www\mytest2\upload\" . basename( $_FILES['uploaded']['name']) ;and got an error message also, say:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\MyTest2\p3_new_import2.php on line ...I can't find out any problem one that.is there any suggestion for the code?thank you,
  8. hello,I use the following code to choice a file and the path information. and I hope to get those information using POST method for data import action in the next step. <html><font face='Times'><h2><center>this is my test project II </center></h2><p><h4><center>Load CSV file into MySQL database (p3_new)</center></h4><hr>Note:<p>1.all of missing values in CSV file will be changed as \N<p>2.the date format is: M/D/YYYY; the link (http://www.dan.co.uk/mysql-date-format/) for the detail of date format <hr><form action="p3_new_import2.php" enctype="multipart/form-data" method="POST"> <input name="csvfile" type="file" size="100" /><p><input type="submit" value="Submit" /> </form></font></html>How to get those information using PHP?Thank you,
  9. Thank you. I'll do that.
  10. hello,I had used the following sql code before. It works fine. But when I use it again (change path and field only), I got error message.Where is the problem in the code?error from mysql:mysql> use mytest;Database changedmysql> load data INFILE C:/wamp/www/MyTest2/ex_file/data_first.txt' into table p3 '> fields terminated by '\t'Outfile disabled. '> lines terminated by '\n'ERROR:Unknown command '\n'. '> IGNORE 1 LINES '> (study_id,family_id,date_visit, ‘%M/%d/%Y’, wbc,hgb_g_dl,hct_pctg,plt,na,k,cl,co2, '> Glucose,bun,cr,gfr,hdl,ldl,chol,trigl,hga1c,ma_cr,Comments) '> ; '>
  11. Hello,I got many text format files with date fields. The date field formats are all mm/dd/yyyy(ex. 10/23/2007)I know there is a "date" format in mysql. But it handles the date format as yyyy-mm-dd.I want to know how to work on the kind of date format.Thank you,
  • Create New...