Hello, I am using drupal along with a pgsql database, but after lengthy searches I still can't learn how to put a presentTIMESTAMP or now() in to the database when placing a row right into a table. Putting now() around the default worth of a column will not work, because drupal will not accept it around the database schema, so that's from question.

The present column type is "timestamp without timezone" or "time without timezone", which drupal's schema accepts. Now the issue is placing to start dating ? there.

I've attempted:

$now = format_date(time(), 'custom', 'Y-m-d H:i:s');

and placing it using the string placeholder '%s', but pgsql provided a mistake.

I additionally attempted to alter the kind to integer and place using time() php function, also it did not work (whether it did i'd apply it to other tables), so perhaps i'll stick to the timestamp type because it is will work better.

Thanks ahead of time.

Below you discover my suggestions in the comments towards the question.

  • You should use 'now' like a string enclosed in single quotes, but current_timestamp shouldn't be in quotes.
  • For those who have a period-stamp you have to enclose it in single quotes: '2010-10-10 14:13:22'
  • You receive the mistake "invalid syntax" since the string is empty. Check that you will have something within the variables which it isn't a clear string.
  • Your timestamp that you simply attempt to place is missing the date.