This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Querying machform database


  1. isak
    Member

    Can someone point me in the right direction for querying info from the database created by machforms? I need a way to create a link that will pull certain fields into a page for one use and other fields for another use. Help?

    Posted 14 years ago #
  2. redityo

    Hello,

    machform use 'ap_form_x' (x is your form ID) table to store the data, You can simply use this SQL to retrieve machform data :

    select element_1,element_2 from ap_form_3

    that SQL will return element 1 and 2 data from form 3. If you need to populate an option field type, you can refer to this post :

    http://www.appnitro.com/forums/topic/drop-downs-and-mysql?replies=11

    http://www.appnitro.com/forums/topic/mysql-question?replies=5


    MachForm Support

    Posted 14 years ago #
  3. isak
    Member

    Many gracias!!

    Posted 14 years ago #
  4. isak
    Member

    I tried both examples you gave me for pulling the value of a dropdown into a search results page and they worked. However, I am pulling several records into the search results. The value being placed in the results page is the value of the first record only when the value for each record in my test is different.

    If you go to this link: http://pdgrafiks.com/results.php you will see that the Property Type and the Office are the same in each row when in the database the values are all different.

    Help?

    Posted 14 years ago #
  5. isak
    Member

    Please help... I cannot get this to work. I have tried both options and they seem to pull from the correct column in my database, but the info is the same in each result whereas in the database it is different. If you go to this link: http://pdgrafiks.com/results.php you will see that the Property Type and the Office are the same in each row when in the database the values are all different.

    Here are the codes I have used:

    SELECT A.*,
    B.option AS element_13_value,
    C.option AS element_14_value
    FROM
    (ap_form_2 AS A
    LEFT JOIN ap_element_options AS B
    ON A.element_13=1 AND B.element_id=13 AND B.option_id=1 and B.form_id=2)
    LEFT JOIN ap_element_options AS C
    ON A.element_14=1 AND C.element_id=14 AND C.option_id=2 and C.form_id=2

    ........
    SELECT A.*,B.option
    FROM
    ap_form_2 A left join ap_element_options B
    on
    A.element_13=B.option_id and B.element_id=13
    WHERE
    B.form_id=2

    I have tried all I know. Please help.

    Posted 14 years ago #
  6. redityo

    Hmmm ... from your SQL, I assume your form id = 2 and you have 2 drop down (options) field, that are :

    - element 13
    - element 14

    Then try to Query machform data with these SQL

    select
          A.*,
          B.option as element_13_value,
          C.option as element_14_value
      from
          (ap_form_2 as A
           left join ap_element_options as B
                  on A.element_13=B.option_id and B.element_id=13 and B.form_id = 2)
           left join ap_element_options as C
                  on A.element_14=C.option_id and C.element_id=14 and C.form_id=2

    MachForm Support

    Posted 14 years ago #
  7. mattbontrager
    Member

    I'm having the same problem.
    I pasted the above sql text directly in (changing the element_#'s of course) and...NADA. Seriously... is there not an easier way to do this? I've been struggling with this for so long. It would seem that the point of having forms that submit to databases would only be useful if you could render that data in a customized, relevant way.

    I was so happy when I discovered this application because it seems geared toward people who like to spend they're time using it... not learning it / learning programming. Please help me.

    Posted 14 years ago #
  8. redityo

    Hmmm .. I think the code should works, anyway could you send me your FTP login info and the form url to :

    customer.service[at]appnitro.com

    i will help you with the SQL


    MachForm Support

    Posted 14 years ago #
  9. isak
    Member

    Just sent the info. Many gracias.

    Posted 14 years ago #
  10. redityo

    ok .. I got your mail, let's continue there


    MachForm Support

    Posted 14 years ago #

RSS feed for this topic

Reply