<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>Yap that was what I was saying that I thought you might
have problems with your date. Sorry didn't notice the $datum declaration
you had at the top.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>I think the way you format the date has to match with your
PostGreSQL date style or I think also the ISO date standard which
is YYYY-MM-DD</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>and as I mentioned you need to quote your date field in
your sql so your sql should be</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007>INSERT INTO
fahrtenbuchtabelle(fid,date_start_fahrt,date_insert,strecke)
VALUES
($z_eintraege,'$datum','$datum',GeometryFromText('LINESTRING($breitengrad1
$laengengrad1, $breitengrad $laengengrad)',4326))"; </SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>I also tend to go with the ISO date standard - less
headache since it is not ambiguous like the other formats. So your $datum
would be declared</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>$datum = date("Y-m-d", $timestamp);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>Also since you renamed your table, make sure to change the
entry in geometry_columns table if it is not correct otherwise you may run into
issues displaying the data.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=398265712-13042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Gerald Baumgartner<BR><B>Sent:</B> Friday, April 13, 2007 8:55
AM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users]
Problems with PHP and PostgreSQL/PostGIS<BR></FONT><BR></DIV>
<DIV></DIV>I have renamed the tablename, but now there are other
errors:<BR><BR><B>Warning</B>: pg_query() [<A
href="http://localhost/GpsDaten/function.pg-query">function.pg-query</A>]: Query
failed: ERROR: column "date_start_fahrt" is of type date but expression is of
type integer at character 36 HINT: You will need to rewrite or cast the
expression. in <B>C:\ms4w\Apache\htdocs\GpsDaten\GPS_Daten_einlesen.php</B> on
line <B>103</B><BR><BR><B>Warning</B>: pg_query() [<A
href="http://localhost/GpsDaten/function.pg-query">function.pg-query</A>]: Query
failed: ERROR: invalid input syntax for type numeric: "" in
<B>C:\ms4w\Apache\htdocs\GpsDaten\GPS_Daten_einlesen.php </B>on line
<B>112</B><BR> <BR><BR>php Code:<BR> <BR>
$timestamp=time();<BR>
$datum=date("d/m/y",$timestamp);<BR><B></B><BR>
if($z_eintraege==2)<BR>
{<BR> $sql_befehl="INSERT INTO
fahrtenbuchtabelle(fid,date_start_fahrt,date_insert,strecke)
VALUES
($z_eintraege,$datum,$datum,GeometryFromText('LINESTRING($breitengrad1
$laengengrad1, $breitengrad $laengengrad)',4326))";
<BR>
$res=pg_query($connection,$sql_befehl);<BR>
$sql_befehl_select="SELECT max(FID) as fid from
fahrtenbuchtabelle";<BR>
$res_fid=pg_query($connection,$sql_befehl_select);<BR>
$fahrtnummer=pg_result($res_fid,"fid"); <BR>
<BR> }<BR>
if($z_eintraege>2)<BR> {<BR>
$sql_befehl_append="UPDATE fahrtenbuchtabelle SET
strecke=AddPoint(strecke,GeomFromText('POINT($breitengrad $laengengrad)',4326))
where fid='$fahrtnummer'"; <BR>
$result=pg_query($connection,$sql_befehl_append);<BR>
}<BR><BR>Gerald<BR><BR>
<DIV><SPAN class=gmail_quote>2007/4/13, Obe, Regina <<A
href="mailto:robe.dnd@cityofboston.gov">robe.dnd@cityofboston.gov</A>>:
</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>When you
created your table it appears you created it as <FONT face="Times New Roman"
color=#000000 size=3>FahrtenbuchTabelle, but in your PHP sql, you don't have
the table name quoted, it will take what you have and insert into a table
called fahrtenbuchtabelle. All table names that are not quoted in sql
will be lowercased when passed to the processor.</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>To
minimize on headache, you really should rename your table in PostgreSQL to
<FONT face="Times New Roman" color=#000000 size=3>fahrtenbuchtabelle.
Note that PostgreSQL table names are case sensitive so
FahrtenbuchTabelle and fahrtenbuchtabelle are not the same
name.</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Other possibly potential problem, I can't tell how you are passing
in your $datum date, but may need to be quoted.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Hope that
helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Regina</FONT></SPAN></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A> [mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A>] <B>On Behalf
Of </B>Gerald Baumgartner<BR><B>Sent:</B> Friday, April 13, 2007 8:14
AM<BR><B>To:</B> <A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><B>Subject:</B>
[postgis-users] Problems with PHP and PostgreSQL/PostGIS<BR></FONT><BR></DIV>
<DIV><SPAN class=e id=q_111eae8f193d3195_1>
<DIV></DIV>Hi everyone!<BR><BR>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.<BR><BR>Please can someone help me!<BR><BR><BR><SPAN
style="FONT-WEIGHT: bold">The error message from the php file in
firefox:</SPAN><BR><BR><B>Warning</B>: pg_query() [<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://localhost/GpsDaten/function.pg-query"
target=_blank>function.pg-query</A>]: Query failed: ERROR: relation
"fahrtenbuchtabelle" does not exist in
<B>C:\ms4w\Apache\htdocs\GpsDaten\GPS_Daten_einlesen.php</B> on line
<B>103<BR><SPAN style="FONT-WEIGHT: bold"><BR><BR></SPAN>Here are the commands
in the php file</B>:<BR><BR>
if($z_eintraege==2)<BR>
{<BR> $sql_befehl="INSERT INTO
FahrtenbuchTabelle(FID,Date_Start_Fahrt,Date_Insert,Strecke) VALUES
($z_eintraege,$datum,$datum,GeometryFromText('LINESTRING($breitengrad1
$laengengrad1, $breitengrad $laengengrad)',4326))";
<BR>
$res=pg_query($connection,$sql_befehl);<BR>
$sql_befehl_select="SELECT max(FID) as fid from
FahrtenbuchTabelle";<BR>
$fahrtnummer=pg_query($connection,$sql_befehl_select);<BR>
<BR> } <BR>
if($z_eintraege>2)<BR>
{<BR> $sql_befehl_append="UPDATE
FahrtenbuchTabelle SET
Strecke=AddPoint(Strecke,GeomFromText('POINT($breitengrad
$laengengrad)',4326)) where FID='$fahrtnummer'";
<BR>
$result=pg_query($connection,$sql_befehl_append);<BR>
}<BR><BR><SPAN style="FONT-WEIGHT: bold">And there is my table in
postgresql/postgis:</SPAN><BR><BR>CREATE TABLE
"FahrtenbuchTabelle"<BR>(<BR> "FID" numeric NOT NULL, <BR>
"Date_Start_Fahrt" date NOT NULL,<BR> "Date_Insert" date NOT
NULL,<BR> "Strecke" geometry,<BR> CONSTRAINT "FahrtID" PRIMARY KEY
("FID"),<BR> CONSTRAINT "enforce_dims_Strecke" CHECK (ndims("Strecke") =
2), <BR> CONSTRAINT "enforce_geotype_Strecke" CHECK
(geometrytype("Strecke") = 'LINESTRING'::text OR "Strecke" IS NULL),<BR>
CONSTRAINT "enforce_srid_Strecke" CHECK (srid("Strecke") = 4326) <BR>)
<BR>WITHOUT OIDS;<BR>ALTER TABLE "FahrtenbuchTabelle" OWNER TO
postgres;<BR><BR>Already thankful for any ideas.<BR></SPAN></DIV></DIV>
<DIV>
<P></P>
<HR SIZE=1>
<P></P><BR>
<P><STRONG><BR>The substance of this message, including any attachments, may
be<BR>confidential, legally privileged and/or exempt from
disclosure<BR>pursuant to Massachusetts law. It is intended solely for
the<BR>addressee. If you received this in error, please contact the
sender<BR>and delete the material from any
computer.<BR></STRONG></P></DIV><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net
</A><BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>