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

Retrieve Data


  1. brucenow
    Member

    I've created my first form. Now I want to retrieve data from the database. I'm guessing the name of the table is form_1, and I have no idea what the field names are. It wasn't clear to me from the form creation what their name would be.

    But I would like to be able to retrieve specific field values from a record.

    Just to see if I could get anything from the database I tried this code:
    (substituting my database name and user name)

    '<?php>'
    'mysql_connect("localhost", "database_name", "password") or die(mysql_error());'
    'mysql_select_db("test") or die(mysql_error());'

    '$result = mysql_query("SELECT * FROM form_1");'

    'echo $result;'
    '?>'

    but got a blank page.

    Bruce

    Posted 15 years ago #
  2. yuniar

    The field names within the table should be something like "element_1" ... "element_2"... etc. You can check into the table directly to see it (you will need to use phpMyAdmin or any other mysql console to see it).

    Also, it seems you are missing some code there.
    It should be something like this:

    <?php
    
    mysql_connect("localhost", "database_name", "password") or die(mysql_error());
    mysql_select_db("test") or die(mysql_error());
    
    $result = mysql_query("SELECT * FROM form_1");
    $row    = mysql_fetch_array($result);
    
    echo $row['element_1'];
    echo $row['element_2'];
    echo $row['element_3'];
    ?>

    MachForm Founder

    Posted 15 years ago #
  3. brucenow
    Member

    Thanks for your reply. I copied it into a Wordpress page. (I'm using the "exec-php" plugin) I got this message:

    Parse error: syntax error, unexpected ‘=’ in /home1/neighbr0/public_html/punkobama/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 5

    I tried it with a simple .php page that I uploaded to the site and got the same message:

    Parse error: syntax error, unexpected '=' in /home1/neighbr0/public_html/punkobama/machform-1.php on line 5

    So what's with that?
    I much appreciate any help.

    Bruce

    Posted 15 years ago #
  4. yuniar

    That's odd. Can you send me your PHP file please? I'll check it.
    You can send it via email: customer.service [at] appnitro.com


    MachForm Founder

    Posted 15 years ago #

RSS feed for this topic

Reply