sql data export through php

I'm exporting data from an old db to a new one with less fields, different field types, and so on. What i did first was copy the table as is from the old database to the new one, naming it tickets2. I'm using a php script to transform data within the old table and pass it to the new one.

This is the problem, I can't even get the SQL parser to recognise the following simple statement : (ive tried all of the following)

INSERT INTO tickets ('ID') SELECT ('ID') FROM tickets2

INSERT INTO tickets ('ID') VALUES ( SELECT ('ID') FROM tickets2 )

Obviously the SQL statement to transfer all the data is way more complex, but this doesn't even work. What's going on?

Comments

  • : INSERT INTO tickets ('ID') SELECT ('ID') FROM tickets2
    :
    : INSERT INTO tickets ('ID') VALUES ( SELECT ('ID') FROM tickets2 )
    :
    : Obviously the SQL statement to transfer all the data is way more complex, but this doesn't even work. What's going on?

    a couple of wild guesses:

    [1] the privileges of your new table aren't properly setup
    [2] there are a couple of other fields in your table that have to be filled with "not NULL" values

  • Maybe silly question but are you even connected to database? i.e. for pgreSQL databases
    $db = pg_connect("dbname=database_name user=user_name");
    and then you have to execute query pg_exec($db, $query);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories