Willy Koch Posted February 2, 2005 Share Posted February 2, 2005 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 Link to comment Share on other sites More sharing options...
stash Posted February 9, 2005 Share Posted February 9, 2005 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 Link to comment Share on other sites More sharing options...
laker_42 Posted February 15, 2005 Share Posted February 15, 2005 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 Link to comment Share on other sites More sharing options...
stash Posted February 21, 2005 Share Posted February 21, 2005 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. Link to comment Share on other sites More sharing options...
Willy Koch Posted March 7, 2005 Author Share Posted March 7, 2005 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! Link to comment Share on other sites More sharing options...
Willy Koch Posted March 8, 2005 Author Share Posted March 8, 2005 Ok, I figured it out. I was a bit confused but now I'm fine. 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! Link to comment Share on other sites More sharing options...
Willy Koch Posted March 8, 2005 Author Share Posted March 8, 2005 Ok, I figured it out. I was a bit confused but now I'm fine. 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! Link to comment Share on other sites More sharing options...
Willy Koch Posted March 8, 2005 Author Share Posted March 8, 2005 Ok, I figured it out. I was a bit confused but now I'm fine. 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! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6590 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now