Page 1 of 1

Capture time from server mysql and assign to variable

Posted: Mon Oct 11, 2010 9:31 pm
by fernandopm
I need capture time from server mysql using command NOW(); and assign to variable global y possible?

Thank's

Re: Capture time from server mysql and assign to variable

Posted: Tue Oct 12, 2010 6:43 am
by Janschenkel
Assuming you've already connected to the database using the revOpenDatabase function, it's as easy as using the revDataFromQuery function to call into the remote function:

Code: Select all

on mouseUp
  global gDatabaseId  -- return value from revOpenDatabase
  answer revDataFromQuery(comma, return, gDatabaseId, "SELECT NOW()")
end mouseUp
If the database is not on the same local network, I urge you to move this logic to a CGI script on the server, as it is not recommended to allow world-wide direct access to your MySQL database. Instead, you should always go through an 'application' layer.

Jan Schenkel.