where should I change an entry in <span><font color="#0000ff" face="Arial" size="2"><span style="color: rgb(0, 0, 0);">geometry_columns table? I can't see there anything about the table I had changed.</span><br><br><span style="color: rgb(0, 0, 0);">
Gerald</span><br></font></span><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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">and as I mentioned you need to quote your date field in
your sql so your sql should be</font></span></div><span class="q">
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span>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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div></span>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">$datum = date("Y-m-d", $timestamp);</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hope that helps,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Regina</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><span class="q"><b>From:</b>
<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users-bounces@postgis.refractions.net</a>
[mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users-bounces@postgis.refractions.net</a>] <b>On Behalf Of
</b>Gerald Baumgartner<br></span><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><span class="e" id="q_111eb1135a4b04c6_5">
<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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">robe.dnd@cityofboston.gov</a>>:
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">When you
created your table it appears you created it as <font color="#000000" face="Times New Roman" 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 color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">To
minimize on headache, you really should rename your table in PostgreSQL to
<font color="#000000" face="Times New Roman" 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 color="#0000ff" face="Arial" 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 color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hope that
helps,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Regina</font></span></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users-bounces@postgis.refractions.net
</a> [mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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 href="mailto:postgis-users@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users@postgis.refractions.net</a><br><b>Subject:</b>
[postgis-users] Problems with PHP and PostgreSQL/PostGIS<br></font><br></div>
<div><span>
<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 href="http://localhost/GpsDaten/function.pg-query" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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 href="mailto:postgis-users@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users@postgis.refractions.net
</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br></span></div></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>