Skip to Content Skip to Menu

The "datum" column

  • hansiman
  • hansiman
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
15 years 8 months ago #90911 by hansiman
The "datum" column was created by hansiman
Hi!

I am going to develop a component, which will use the uddeIM component to communicate with the users.

When I inserts a row/message in the table, the datum column is set as the year of the timestamp.
Eg. if I inserts a message using the following SQL query:
INSERT INTO jos_uddeim (fromid, toid, message, datum) VALUES('$uid', 84, '$message', NOW())
it sets the "datum" column as the current year (2009).

How do I insert the date in the correct format?

Thanks in advance!

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
15 years 8 months ago #90921 by slabbi
Replied by slabbi on topic Re:The "datum" column
Its a unix date (seconds from 1.1.1970).

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • hansiman
  • hansiman
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
15 years 8 months ago #90926 by hansiman
Replied by hansiman on topic Re:The "datum" column
Thank you very much for your reply!

I can't try the solution right now, but can I use the UNIX_TIMESTAMP() function in mysql?

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
15 years 8 months ago #90928 by slabbi
Replied by slabbi on topic Re:The "datum" column
Think so. I use a php function for that (time()).

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • hansiman
  • hansiman
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
15 years 8 months ago #90930 by hansiman
Replied by hansiman on topic Re:The "datum" column
I'll give it a try.

Thank you very much for your help.
I'll follow up if I have further problems.

Please Log in or Create an account to join the conversation.

15 years 8 months ago #91486 by ProvaStyle
Replied by ProvaStyle on topic Re:The "datum" column
Could someone help me with this syntax? I can't seem to figure out what to put for the datum column.
I know the error's from the datum field, but I don't know what to put.

Here's my code:
[code:1]
$query = "INSERT INTO #__uddeim (fromid, toid, message, datum, disablereply, systemmessage)
VALUES (64, 62, 'your message', (timestamp
now), 1, 'Wildfire')";
$db->setQuery( $query );
if (!$db->query()) {
die("SQL error" . $db->stderr(true));
}[/code:1]

& I get this error:

[code:1]SQL errorDB function failed with error number 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'now), 1, 'Wildfire')' at line 2 SQL=INSERT INTO ***_uddeim (fromid, toid, message, datum, disablereply, systemmessage) VALUES (64, 62, 'your message', (timestamp now), 1, 'Wildfire')
SQL =
INSERT INTO ***_uddeim (fromid, toid, message, datum, disablereply, systemmessage)
VALUES (64, 62, 'your message', (timestamp now), 1, 'Wildfire')
[/code:1]

Thanks,
-David

Please Log in or Create an account to join the conversation.

Moderators: beatnantslabbikrileon
Powered by Kunena Forum