February 2, 200520 yr 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
February 9, 200520 yr 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
February 15, 200520 yr 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
February 21, 200520 yr 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.
March 7, 200520 yr 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!
March 8, 200520 yr Author 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!
March 8, 200520 yr Author 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!
March 8, 200520 yr Author 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!
Create an account or sign in to comment