• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to call php function from CF?

Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Hello,

Since the MSSQL driver isn't compiled in my PHP installation, I can't connect to a SQL Server database from PHP.

Therefore, I have created a SQL Server connection in my CF Admin page and I've created a small script that's reading records from the SQL Server database and inserting/updating my table in MySQL.

Now, owing to UTF-8 encoding, I've created another function in PHP that actually reads the synchronised records and updates them into UTF-8 e.g. for french accents, etc.

The above situation works great, however, there are 2 files actually -

  1. 1 CF-file to read from SQL Server and insert into MySQL (readFromMSSQL.cfm)
  2. 1 PHP-file to read the inserted records and update them using UTF-8 encoding (updateData.php)

Ideally, every time I lauch the application (which runs mainly on PHP), it should synchronise the SQL Server and the MySQL databases so that data is consistent.

Now, I'm having 2 files for that matter.

How do I

  1. either call the PHP function or PHP-file from my cfm file? Ideally. This is because I can then create a scheduled task in my CF Admin and make it run e.g. every morning.
  2. or call my cffunction from my PHP-file?

So that, in the end, I only need to call 1 single file which does everything.

Thanks in advance for your help.

Best regards,

Yogesh Mahadnac.

TOPICS
Advanced techniques

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Make this:

Therefore, I have created a SQL Server connection in my CF Admin page and I've created a small script that's reading records from the SQL Server database and inserting/updating my table in MySQL.

a webservice that you can call from php.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

Thanks a lot for your reply Dan.

I'll definitely give it a try.

Best regards,

Yogesh Mahadnac.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

LATEST

Use just one database: MySQL in UTF-8 encoding. Then ColdFusion, PHP, ASP, .NET, or whichever, may connect to it, update it or read from it. MySQL doesn't know which is which, and doesn't care.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation