nichemtktg — 2011-06-29T17:59:41-04:00 — #1
Is there a function or simple technique for moving data from one MYSQL file to another when the column names from the source file match the column names of the target file other than using mysql_fetch_array?
If so, what do you recommend?
r937 — 2011-06-29T18:05:05-04:00 — #2
what do you consider a mysql "file" ??
nichemtktg — 2011-06-29T18:14:42-04:00 — #3
A file that I can access with phpmyadmin
r937 — 2011-06-29T18:16:21-04:00 — #4
you mean a database? or a table within a database?
nichemtktg — 2011-06-29T18:33:11-04:00 — #5
I found SELECT INTO.
I'm tried using:
mysql_query("SELECT cliorder INTO plan2 FROM preplan") or die(mysql_error());
but got an error that said: Undeclared variable: plan2
plan2 already exists as a table. Am I on the right track?
nichemtktg — 2011-06-29T18:45:10-04:00 — #6
mysql_query("INSERT INTO plan2(cliorder) SELECT cliorder FROM preplan") or die(mysql_error());
Thanks r937. It's always good to know you'll help.
r937 — 2011-06-29T18:47:39-04:00 — #7
you shouldn't need to run that query in a php program -- just run it in your front end app (phpmyadmin or whatever)
if you plan on copying data from one table (not file) to another more than once, you should probably re-think why
nichemtktg — 2011-06-29T19:05:32-04:00 — #8
excellent points! I keep forgetting about running it through myphpadmin although php provides a way to track the work.
Thanks again r937.