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.

ODBC Queries via PHP extreemly slow, timeout.

Featured Replies

  • Newbies

FM7 advanced server running on a Microsoft small business server.

I am basically trying to run a SELECT query on certain records from the FMP7 db using ODBC scripted into PHP and INSERT them into a MySQL database.

All seems to be setup correctly and working fine, but this.

When I run the same query from Microsoft Excel it executes within milisec's.

ps. the php file executes on an apache webserver.

#######################################

############# dbQuery.php #############

#######################################

<html>

<head>

<title>DatabaseQuery</title>

</head>

<body>

<?php

# connect to a DSN "ECM_Product" with a user and password "Removed"

$connect = odbc_connect("ECM_Product", "Removed", "Removed");

# query the productInfo table for info

$query = "SELECT product, brand, inProducts, inSupport, site, Price FROM ECM_Product";

# perform the query

$result = odbc_exec($connect, $query);

# fetch the data from the database

$data = array();

for($x = 0; $x < odbc_num_rows($result); $x++) {

$data[] = odbc_fetch_array($result);

}

# close the connection

odbc_close($connect);

$connect = mysql_connect("Removed", "Removed", "Removed");

mysql_select_db("ecm_product");

mysql_query("TRUNCATE productinfo");

for($x = 0; $x < count($data); $x++) {

$product = $data[$x]["product"];

$brand = $data[$x]["brand"];

$inProducts = $data[$x]["inProducts"];

$inSupport = $data[$x]["inSupport"];

$site_id = $data[$x]["site"];

$price = $data[$x]["Price"];

mysql_query("INSERT INTO productinfo (product, brand, inProducts, inSupport, site_id, price) VALUES

('".$product."','".$brand."','".$inProducts."','".$inSupport."','".$site_id."','".$price."')");

echo mysql_error($connect);

}

mysql_close($connect);

?>

</body>

</html>

#######################################

Please help, deadline is coming close smile.gif

  • 3 weeks later...

Hi there,

we are trying to accomplish the same. Were you able to solve the issue?

Do you have evaluation fields or calculation fields which are not indexed in the FM table that you want to query? That might cause to get a query slow (if I am not mistaken FM conducts a query via ODBC the same way it does when looking up records in client mode).

Greetings

  • 5 months later...

Any one ever get anywhere with this?

I'm still gettting a 30 sec time out for

select fiel1, field2 from table

when the result has > 10 rows.

ODBC support on FileMaker is horrendous. Especially the presence of Summary Fields or Calculations in the table will bring the computer to its knees. It appears to require computing everything field for every record in the table even for a simple query such as yours.

I have concluded that unless one is quite knowledgeable about FileMaker internals and quite careful in the design, it is easy to get behavior that is exponential in time with the number of records.

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.