SQL Query sending data from Custom Form to Postgres


(Pw) #1

I'm trying to put some data via Custom Form to Postgres table.


So i set up in "Submission Actions" connection to DB and it works well when I'm using query like:

INSERT INTO table_name VALUES

(

'a', 'b', 'c', 'd'

);



I don't know how to handle Custom Form questions. I tried many combinations like:

INSERT INTO table_name VALUES

(

'%response_33925_q2%', '%response_33925_q3%', '%response_33925_q4%', '%response_33925_q5%'

);

and it doesn't work :-\



I use Mysource Matrix 3.24.4


(Greg Sherwood) #2

What exactly isn't working? Can you log queries on your DB to find out what query is being sent and the error being generated?


(Pw) #3

[quote]
What exactly isn't working? Can you log queries on your DB to find out what query is being sent and the error being generated?

[/quote]

I tried. When I used bad syntax of keywords like:

INSERT INTO table_name VALUES

(

'%response_33925-q2%', '%response_33925-q3%', '%response_33925-q4%', '%response_33925-q5%'

);

queries are logged, but when I use good syntax

INSERT INTO table_name VALUES

(

'%response_33925_q2%', '%response_33925_q3%', '%response_33925_q4%', '%response_33925_q5%'

);

then nothing goes into log. Is there a way to test if Matrix sends anything to database?


(Greg Sherwood) #4

The best way to test it is to enable query logging in PostgrSQL and watch what happens. Obviously this is best done on a test system or the log will get full very quickly under high load.


(Noel) #5

Has there been a solution to this problem?


I am using mysql, and have similar problems. matrix does execute the query, but instead of data entered by the user, i get values like ":response_1" inserted in the database. I guess I am using incorrect keywords, but I can find no documentation on the proper keywords to use.



I am currently using 3.18.9


(M Kharod) #6

Hi

 

I have used following query in one of my project and it worked.

 

INSERT INTO table_name(field1,field2) VALUES(%response_231386_q1%,%response_231386_q2%);


(Clementoke) #7

I've just attempted using a custom form to insert into a database but nothing happens, the form just reloads as a blank, nothing in the submission logs or incomplete submissions. Nothing shows up in the database either.

The submission action is valid and checks out when I run the same statement in phpMyAdmin so I'm drawing a blank here.

Any ideas?