I need to get the values from a serialized string, to use it on some statistics. I already got that info in other pages to show some content, but I have no idea why I'm having this problem now.
The DB has a table called
wj_db7_forms (I'm using a WordPress plugin to log the inputs on a form).
And the column with the info I need is on
Cleaning the content of the column, there is a part with
I want to get all the forms, and on every one, get the value for
city. That value can have any lenght, because it's an open input.
I tried a lot of ways, but none worked.
I get erros like
Parse error: syntax error, unexpected 'city' (T_STRING)
or don't get errors at all, but the variable seems empty, etc.
<?php global $wpdb; $table_name = $wpdb->prefix.'db7_forms'; $results = $wpdb->get_results( "SELECT form_value FROM $table_name WHERE form_post_id = 6062", OBJECT ); $form_data = unserialize( $results->form_value ); print_r($form_data); ?>
With that code, I get all the info from the form, but I get everything, including info from other columns... And only from one form. I need to get from all the forms with that 'form_post_id' that are inside 'wj_db7_forms' table.
The content inside the 'form_value' of one of the forms is here: https://pastebin.com/e6LzJzLS
$form_data['city'] works now. But I need to get the values for all the forms. It only returns one for me.