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.

Import from SQL into repeating fields

Featured Replies

Hi.

Glad to have found this forum.

I am trying to import data from

a mysql database (which gets fed by an php script)

via ODBC into FM. Everything works fine,

unless the correct splitting into the repeated fields. I had this import working via csv,

where i used this special character.

However, the string provided by mysql gets

not recognized by FM.

Your help is very much appreciated!

/Alex

Hi Alex,

Whats the code your using?

  • Author

Hi Genx

The php script takes the POST data

array, and makes a string for the

sql query. The ^K is copied

directly from an XML output of FM.


  foreach($indata as $key => $value) {

    if (is_array($indata[$key])) {

      $value = @implode("^K", $indata[$key]);

    }

    $fieldlist .= $key.", ";

    $values .= "'".$value."', ";

  }

Regards,

Alex

Edited by Guest

Hi Alex,

Could you actually post the resulting sql query string -- or rather an example of a result query string?

Cheers,

Alex

Hmmm, maybe i'm looking at this the wrong way...

You're calling a MySQL query, then entering the results into FM via PHP through an ODBC connection?

  • Author

Hi Genx!

The php scripts collects html form data and puts it into the mysql database via an mysql query.

The query string is:


INSERT INTO campers (PhoneType, PhoneIntl, PhoneArea) VALUES ('Cell', '46', '70', '3067')

Then i get the data via an odbc import.

That means i query the sql database from fm.

Regards, Alex

  • Author

Another problem is the picture import.

(I tried different sql field formats - mediumblob

and binary)

This doesn't work either.

Maybe you have an idea.

Thanks for your help!

/A

Okay, well, repeating fields aren't supported via ODBC -- so you're kind of stuck there -- though you could import the data into a field and then parse it out into a set of repeating fields... but why are you using them in the first place?

The picture should just be blob type.

  • Author

Hi Genx!

The filemaker database is not done by me,

I am just doing the web frontend/ form collection stuff.

But it seems I have to go back to my

other solution, where i send an email and import

the stuff via csv text files.

Do you have another, maybe better idea of

getting data from a form into FM?

Thanks again for helping!

Regards, Alex

The FileMaker PHP API would be good for this ... or Fx.php -- you can find more details on both at www.fmwebschool.com -- they have a great book on both.

Anyway, for a general overview see here: http://filemaker.com/developers/resources/php/

Or you could always tell the developer to change the structure and stick with ODBC -- it's generally fairly easy to do.

  • Author

Hi Genx.

We went back to separated fields.

However, I am stuck with one problem:

The picture is not getting viewed.

The data gets transfered, and I can

get a valid picture with "Export field contents",

but no picture is viewed when the record is shown.

Thanks for your help.

Regards, Alex

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.