473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Insert server time to Postgres DB

250 100+
I want to insert current server time to the postgres database. Data type is timestamp. When I insert the date, got an error saying

Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for type timestamp: "1246960321" in C:\Program Files\xampp\htdocs\xxx\xxx\xxx.php on line 57
Error in SQL query: ERROR: invalid input syntax for type timestamp: "1246960321"

I take the time as follows.
Expand|Select|Wrap|Line Numbers
  1. $today = strtotime("now");
Please help me..
Jul 7 '09 #1
1 4093
Dormilich
8,658 Expert Mod 8TB
wouldn't it be easier in this case to use the SQL function NOW()?
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO ... VALUES ( NOW() )
edit: do you pass the timestamp as string or integer value?
Jul 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
12
by: Martin_Hurst | last post by:
Has some one come up with a similar type script that could be used in a Postgresql database? The script below was created for a SQLServer database. Thx, -Martin ...
4
by: Ati Rosselet | last post by:
I have several tables with common FKs.. the problem occurs when performing a large number of inserts on any of the tables at the same time. The first to start inserting seems to get a lock on the...
8
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
5
by: Louis LeBlanc | last post by:
Hey folks. I'm new to the list, and not quite what you'd call a DB Guru, so please be patient with me. I'm afraid the lead up here is a bit verbose . . . I am working on an application that...
9
by: Sean Shanny | last post by:
To all, I restarted postgres this morning to make a configuration file change take effect and when I looked at the serverlog to make sure things were ok I found the prior shutdown message(*in...
8
by: Josué Maldonado | last post by:
Hello List, I'm importing some data from Foxpro to Postgres, there is atable wich contains aprox 4.8 million rows and it size about 830MB. I uploaded it to Postgres using dbf2pg and worked fine,...
1
by: Philippe Lang | last post by:
Hello, What is the best method to debug a database that *sometimes* gets locked in the INSERT mode? ('ps -afx | grep postgres' shows me a process that is freezed in INSERT mode.) Thanks ...
6
by: Abandoned | last post by:
Hi.. I use the threading module for the fast operation. But i have some problems.. This is my code sample: ================= conn =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.