• Resolved Chloe81

    (@chloe81)


    Hello and thanks for this great plugin. I don’t understand so much of database but I need a way to access a specific value of a specific stored row to compare it with a just submitted value.

    I already find a way to get the row id now I need a way to find that specified row and compare both the values.

    I tried this :
    $myresult = $fmdb->get_row("SELECT * FROM $fmdb->$formsTable WHERE id =$id");
    this:
    $myresult = ("SELECT * FROM'. $fmdb->wp_fm_forms.' WHERE ID = $id" ), ARRAY_A );
    and this:
    $myresult = $fmdb->get_row("SELECT * FROM“.$fmdb->formsTable.”WHEREID=".$id);

    but I always get a Fatal Error or a white page. Could anyone help me? I very need it!!! Thanks again and have a nice day!

    http://wordpress.org/extend/plugins/wordpress-form-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Chloe81

    (@chloe81)

    Ok after hours of study I have understand that I made much errors :D!
    First the database is the same database of wordpress so I have to use $wpdb and not $fmdb.

    My needed was this:
    Find in the main form table (avwp_fm_data_1) the value of a column starting from an id stored in another column which is in the same row.

    So… here the solution… use get_var() and not get_row().

    Here is my code… maybe someone need it:

    global $wpdb;
    $table_name = "avwp_fm_data_1";
    $rescol = "<code>text-519d03291e327</code>";
    $searchcol =  "<code>metaidnumber-519a9eca6f567</code>";
    $myresult = $wpdb->get_var("SELECT $rescol FROM $table_name WHERE $searchcol = $id", 0, 0);

    Remember:
    Declare global var at the start.
    My table name form is avwp_fm_data_1… with the “av” prefix but this is not a standard so checks yours (you can find it in the database check).
    If you make a custom column the name of this column contain a dash that generate a problem in php so remember to use the backticks (`) at beggin and at the end of the column-custom-name.

    That’s all… more easier than previewed!
    Byeee!!!

    Thread Starter Chloe81

    (@chloe81)

    P.S. The “code” indication in the quote is the backtiticks that you have to insert in php! 🙂

    Solved!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get a value from a specific row of fm-database’ is closed to new replies.