0

I'm trying to do some migrations from an old site to a new site. The old site uses MySQL and the new site uses PostgreSQL. My problem is I wrote a migration script in PHP that queries info from the old DB so that I can insert them into the new DB within that same script. The reason I need the script is I have to call other functions that do things and manipulate the data since the table columns aren't a one for one match so I can't just do a backup and restore type situation. I have a class for both DB's that I use.

The mysql queries work but postgres' don't. They get error messages saying pg_query(): 19 is not a valid PostgreSQL link resource in xxx

So is it possible to run them both in the same script? If I call the two scripts separately it works ok but I can't get the data from the old server to the new one. I've looked everywhere and don't see many questions needing to use both DB's in one file. Any help would be cool.

3
  • 1
    My guess is that you are using the same variable for both resources. Post your code that establishes the connections. Commented Jun 13, 2013 at 0:08
  • 1
    @user20232359723568423357842364 Excellent username :-) Commented Jun 13, 2013 at 0:15
  • I don't get the username thing?? Anyway, yeah I think you were right @user20232359723568423357842364. I had two classes one for PG and other for MySQL. Well they both have the same functions but different PHP api's so I didn't think it made a difference. Since I won't be using MySQL anymore, I manually wrote the queries instead of using the class and it seems to work. Should have made it an answer. :) Commented Jun 13, 2013 at 1:01

1 Answer 1

0

You are using the same variable for both resources and passing the mysql resource to the postgresql function

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.