Thread: (mysql to postgresql) in php functions

(mysql to postgresql) in php functions

From
"Camarao, Wagner (v)"
Date:
Hi. I am migrating a site database from MySQL to PostgreSQL.

    First I just changed the function calls and then I got the error
message that PHP was not compiled with PostgreSQL support.

    Ok, so I recompiled the PHP as necessary and now the problem is that
there was a function being used, called mysql_select_db();, that there is
none to use with PostgreSQL instead of it.

    I really dont know if it is necessary to use the select_db function
after the connection to the database. But I think so, because when I try to
execute a query (without running the select_db function) I get the error
message:

    "Fatal error: Call to undefined function: pg_query() in
/path/file.php on line 123"

    Anybody can help me? Although this is not a php mail list?! :-)

Tks,
Wagner


Re: (mysql to postgresql) in php functions

From
Ericson Smith
Date:
There is no need to select a db after connecting to it in Pg. Remember
that the database is in the connection string.

The function calls are ever so slightly different between the two, that
it would be a good idea to look it over very well before going ahead.
Some good pointers are here:
http://www.php.net/manual/en/function.pg-connect.php
http://www.php.net/manual/en/function.pg-fetch-array.php

- Ericson Smith
eric@did-it.com
http://www.did-it.com

On Thu, 2003-04-10 at 16:54, Camarao, Wagner (v) wrote:
> Hi. I am migrating a site database from MySQL to PostgreSQL.
>
>     First I just changed the function calls and then I got the error
> message that PHP was not compiled with PostgreSQL support.
>
>     Ok, so I recompiled the PHP as necessary and now the problem is that
> there was a function being used, called mysql_select_db();, that there is
> none to use with PostgreSQL instead of it.
>
>     I really dont know if it is necessary to use the select_db function
> after the connection to the database. But I think so, because when I try to
> execute a query (without running the select_db function) I get the error
> message:
>
>     "Fatal error: Call to undefined function: pg_query() in
> /path/file.php on line 123"
>
>     Anybody can help me? Although this is not a php mail list?! :-)
>
> Tks,
> Wagner
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Ericson Smith <eric@did-it.com>