LiveCode & OpenCart

Sannyasin Brahmanathaswami brahma at hindu.org
Thu Mar 17 23:45:43 EDT 2016


It's quite straight forward. i believe there were some old remote SQL examples around here... I have an old stack here from 2004 i can send to you. (email me off line)   it's just a matter of entering the correct remote host.

typical connection script looks like this

on mouseUp
  put fld "db user" into dbUser
  put fld "db pass" into dbPass
  put fld "db path" into dbName
  put fld "db address" into dbAddr
  if dbAddr is empty then put "localhost" into dbAddr

  put revOpenDatabase("MySQL",dbAddr,dbName,dbUser,dbPass) into dbresult
  if dbresult is a number then
    put dbresult into fld "db ID"
  else
    answer dbResult
  end if

end mouseUp

where dbAddress is your server's absolute URL like my.domain.com...

But there may be issues with permissions on the web  server, in recent years the idea that you would keep the MySQL port (usually set to 3306) open and listening to the outside has been deemed really, REALLY bad practice. If your client is PCI compliant, then it will definitely be forbidden. But there are ways around this, assuming you have control over the firewall you can set the MySQL port to accept only connections from specific IP's

OTOH, you can avoid all those issues by setting up an API on the server using LC Server or PHP and then you can POST to the API and let the API talk to the database. That's what our desktop client does that talks to our database at www.himalayanacademy.com

It's easy enough to install RevIgniter on the same web server instance... it does not matter that the main site is also running some PHP CMS... you can run revIgniter right on the same web server instance and then use all of Ralf marvelous active db libs for your API. So you have revIgniter or LC server talking to the same database as Open Cart.

You can even have the API be in PHP and post to that and let the PHP do the talking with the database.   with the new LC JSON lib in LC 8 it's easy to take the kind of spreadsheet data you are talking about, package it into a file, post to the server API and that API inserts/ updates the database.




On February 10, 2016 at 6:56:33 AM, tkuypers at telenet.be (tkuypers at telenet.be<mailto:tkuypers at telenet.be>) wrote:

I know there are all kinds of security issues which makes this not so obvious, but maybe someone figured out a way to make this connection?


More information about the use-livecode mailing list