Luis Magaña wrote:
I have the following code:
pg_query($conn,"BEGIN TRANSACTION;
DELETE FROM codigo_postal;
COPY
codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
FROM '$tmpfname2' DELIMITER '|';
COMMIT");
Separate them out as a first step:
$result = pg_query("begin");
if (!$result) {
echo "error at line " . __LINE__ . ": " . pg_last_error() . "<br/>";
}
$result = pg_query("delete from codigo_postal;");
if (!$result) {
echo "error at line " . __LINE__ . ": " . pg_last_error() . "<br/>";
}
$result = pg_query("COPY
codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
FROM '$tmpfname2' DELIMITER '|';");
if (!$result) {
echo "error at line " . __LINE__ . ": " . pg_last_error() . "<br/>";
}
$result = pg_query("commit");
if (!$result) {
echo "error at line " . __LINE__ . ": " . pg_last_error() . "<br/>";
}
and see if you get any errors.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php