Capture time from server mysql and assign to variable

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
fernandopm
Posts: 5
Joined: Wed Dec 13, 2006 8:10 am

Capture time from server mysql and assign to variable

Post by fernandopm » Mon Oct 11, 2010 9:31 pm

I need capture time from server mysql using command NOW(); and assign to variable global y possible?

Thank's

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Capture time from server mysql and assign to variable

Post by Janschenkel » Tue Oct 12, 2010 6:43 am

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.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply