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.

sql: INSERT statement

Featured Replies

Hello, I've been working with mysql and php for a while and now I'm looking into using Filemaker 7 as a frontend.

I think what I'm trying to do is fairly simple:

I want to use Scriptmaker to Execute an SQL query, like this:

INSERT INTO journalists (contact, name) Values ("' & contact & '","' & name & '")

I've added a new record, two fields, contact and name, and I now want to add that record to the sql database. But how do I get the field values into the INSERT statement?

In php I would do:

<?php

$sql = "INSERT INTO journalists (contact, name) Values ('".$contact."','".$name."')";

?>

What do I do in Scriptmaker?

Thanks a bunch.

Willy

Oslo, Norway

1.0 As first, you need SQL plugin...more info here:

http://www.planetsg.com/PLANet/PLANet_HowTo/PDMConfiguration.htm

2.0 Next thing is to consider ODBC and JDBC.

check out: http://www.planetsg.com/PLANet/PLANet_HowTo/HowTo.htm

3.0 After you've established connection to the mySQL server, next step is to shout the query by using SQL plugin function :

SetField[someField, External ( "doFTP-Put"; "INSERT INTO journalists (contact, name) Values ('".$contact."','".$name."')")]

Good Luck smile.gif

You can use the Execute SQL() Script step. You then have the option of writing out a fixed SQL statement or you can create a calculated SQL statement. This is what you will want to do. I believe you will write it like you did above and just enter in the FMP fields into the values function.

HTH,

John

Yes, but Execute SQL() script step is supported just by the ODBC. What is about JDBC? In my work, I use both of these connections, depending of what I have to do.

  • 2 weeks later...
  • Author

Hello and thanks for the reply. I'm using ODBC, I bought the Actual ODBCPack which works great.

One question: Could you please show how you would write the INSERT code using the Execute SQL() function? (With fields from the FM database)

Thanks!

  • Author

Ok, I figured it out. I was a bit confused but now I'm fine. smile.gif I did, with the Execute SQL function->Calculated SQL text:

"INSERT INTO `users` ( `id` , `username` , `password` , `reply_to` , `reply_name` , `last_login` , `cookie` )

VALUES (

'', '"&WDev::Navn&"', 'password', '"&WDev::Epost&"', '', '', ''

);"

WDev being the name of the FileMaker database.

It was the '"&WDev::<field>&"' part I couldn't figure out right.

Thanks ya'll!

  • Author

Ok, I figured it out. I was a bit confused but now I'm fine. smile.gif I did, with the Execute SQL function->Calculated SQL text:

"INSERT INTO `users` ( `id` , `username` , `password` , `reply_to` , `reply_name` , `last_login` , `cookie` )

VALUES (

'', '"&WDev::Navn&"', 'password', '"&WDev::Epost&"', '', '', ''

);"

WDev being the name of the FileMaker database.

It was the '"&WDev::P<field>&"' part I couldn't figure out right.

Thanks ya'll!

  • Author

Ok, I figured it out. I was a bit confused but now I'm fine. smile.gif I did, with the Execute SQL function->Calculated SQL text:

"INSERT INTO `users` ( `id` , `username` , `password` , `reply_to` , `reply_name` , `last_login` , `cookie` )

VALUES (

'', '"&WDev::Navn&"', 'password', '"&WDev::Epost&"', '', '', ''

);"

WDev being the name of the FileMaker database.

It was the '"&WDev:B)<field>&"' part I couldn't figure out right.

Thanks ya'll!

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.