[postgis-users] Problems with PHP and PostgreSQL/PostGIS

Gerald Baumgartner baumgartner.gerald at gmail.com
Fri Apr 13 05:13:33 PDT 2007


Hi everyone!

I have created a table and now I want to put a GPS Logfile into this table
with a php file. But the php file doesn't do the inserts.

Please can someone help me!


The error message from the php file in firefox:

*Warning*: pg_query()
[function.pg-query<http://localhost/GpsDaten/function.pg-query>]:
Query failed: ERROR: relation "fahrtenbuchtabelle" does not exist in *
C:\ms4w\Apache\htdocs\GpsDaten\GPS_Daten_einlesen.php* on line *103


Here are the commands in the php file*:

    if($z_eintraege==2)
    {
       $sql_befehl="INSERT INTO
FahrtenbuchTabelle(FID,Date_Start_Fahrt,Date_Insert,Strecke) VALUES
($z_eintraege,$datum,$datum,GeometryFromText('LINESTRING($breitengrad1
$laengengrad1,    $breitengrad $laengengrad)',4326))";
       $res=pg_query($connection,$sql_befehl);
       $sql_befehl_select="SELECT max(FID) as fid from FahrtenbuchTabelle";
       $fahrtnummer=pg_query($connection,$sql_befehl_select);

    }
    if($z_eintraege>2)
    {
      $sql_befehl_append="UPDATE FahrtenbuchTabelle SET
Strecke=AddPoint(Strecke,GeomFromText('POINT($breitengrad
$laengengrad)',4326)) where FID='$fahrtnummer'";
      $result=pg_query($connection,$sql_befehl_append);
    }

And there is my table in postgresql/postgis:

CREATE TABLE "FahrtenbuchTabelle"
(
  "FID" numeric NOT NULL,
  "Date_Start_Fahrt" date NOT NULL,
  "Date_Insert" date NOT NULL,
  "Strecke" geometry,
  CONSTRAINT "FahrtID" PRIMARY KEY ("FID"),
  CONSTRAINT "enforce_dims_Strecke" CHECK (ndims("Strecke") = 2),
  CONSTRAINT "enforce_geotype_Strecke" CHECK (geometrytype("Strecke") =
'LINESTRING'::text OR "Strecke" IS NULL),
  CONSTRAINT "enforce_srid_Strecke" CHECK (srid("Strecke") = 4326)
)
WITHOUT OIDS;
ALTER TABLE "FahrtenbuchTabelle" OWNER TO postgres;

Already thankful for any ideas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070413/b99f4d20/attachment.html>


More information about the postgis-users mailing list