Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP ODBC connection from centos to FM9 Server Advanced

Featured Replies

  • Newbies

Hi there everyone! Ok so I'm just a web developer, not a FileMaker user, but my client is needing something kinda tricky here.

They have a website hosted on CentOS 5 in the Midwest US, and their FM9 Server is located remotely on Maui, on their lan in their office. I have been contracted to create a php script which can either (hopefully) use the existing php odbc drivers or, as they were instructed by a FM rep, to use the DataDirect Unix ODBC driver.

All I'm trying to accomplish first off is telling the PHP script on the CentOS box to connect via IP and correct port to the FM9 server at their office, query 1 table, and return the resultset to the php page. If this goes well, next step is for me to see if we can do read and write access based off of user input on their website. Complicated? Yes. Security issues? Probably! lol

So my first question is, how can I take this script and tell it the right php odbc driver to use, as well as the IP and port to connect to?


<?php

//================================================================



  // All CAPS info is hidden for obvious reasons.   This is all commented out.  What can I use here?

  //$db_host        = "IP:PORT";

  //$db_server_name = "PwfProgramsDB_DSN_Per";

  //$db_name        = "PwfProgramsDB";

  //$db_file        = 'C:Program FilesFileMakerFileMaker ServerDataDatabasesPwfProgramsDB.fp7';

  //$db_conn_name   = "php_script";

  //$db_user        = "USERNAME";

  //$db_pass        = "PASSWORD";







$db = odbc_connect("PwfProgramsDB_DSN_Per", "USERNAME", "PASSWORD");



if( odbc_error($db) ){

die(odbc_error($db).': '.odbc_errormsg($db));

}



$query = 'SELECT First,Last,Address FROM person';

$result = odbc_exec($db, $query) or die('

Query error !

');



odbc_fetch_row($result);

$res1 = odbc_result($result, 1);

$res2 = odbc_result($result, 2);

print("$res1 $res2n");



odbc_close($db);





?>

This script returns

Fatal error: Call to undefined function odbc_connect() in /opt/lampp/htdocs/client/connection.php on line 15

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.