wpnzach
1/26/2016 - 4:00 PM

code-and-output.js

var PHPUnserialize = require('php-unserialize');
var mysql = require('mysql');

connection.query('SELECT * FROM wp_ninja_forms where id =2', function(err, rows, fields) {
  if (err) throw err;
  //console.log('The solution is: ', rows[0].solution);
  for (var i in rows) {
    console.log(rows[i].data);
    var formObject = PHPUnserialize.unserialize(rows[i].data);
    console.log(formObject);
  }
});

a:28:{s:10:"form_title";s:25:"Conditional Logic Example";s:10:"show_title";s:1:"0";s:9:"save_subs";s:1:"0";s:12:"landing_page";s:0:"";s:11:"append_page";s:0:"";s:14:"clear_complete";s:1:"0";s:13:"hide_complete";s:1:"0";s:11:"success_msg";s:0:"";s:10:"sen
d_email";s:1:"0";s:10:"email_from";s:0:"";s:10:"email_type";s:4:"html";s:12:"user_subject";s:0:"";s:14:"user_email_msg";s:0:"";s:17:"user_email_fields";s:1:"0";s:13:"admin_subject";s:0:"";s:15:"admin_email_msg";s:0:"";s:11:"create_post";s:1:"0";s:14:"pos
t_logged_in";s:1:"0";s:7:"post_as";s:1:"0";s:11:"post_status";s:5:"draft";s:9:"post_type";s:4:"post";s:8:"post_tax";a:1:{i:0;s:8:"category";}s:9:"post_tags";s:0:"";s:12:"post_content";s:0:"";s:21:"post_content_location";s:6:"append";s:5:"style";a:1:{s:6:
"groups";a:6:{s:9:"container";a:13:{s:16:"background-color";s:7:"#d3c850";s:6:"border";s:0:"";s:12:"border-style";s:0:"";s:12:"border-color";s:0:"";s:5:"color";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:10:"0 0 20
px 0";s:7:"padding";s:4:"20px";s:7:"display";s:0:"";s:5:"float";s:0:"";s:8:"advanced";s:19:"border-radius: 5px;";}s:3:"row";a:12:{s:16:"background-color";s:0:"";s:6:"border";s:0:"";s:12:"border-style";s:0:"";s:12:"border-color";s:0:"";s:5:"color";s:0:"";
s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:0:"";s:7:"padding";s:0:"";s:7:"display";s:0:"";s:8:"advanced";s:0:"";}s:7:"row-odd";a:12:{s:16:"background-color";s:0:"";s:6:"border";s:0:"";s:12:"border-style";s:0:"";s:12:"bor
der-color";s:0:"";s:5:"color";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:0:"";s:7:"padding";s:0:"";s:7:"display";s:0:"";s:8:"advanced";s:0:"";}s:11:"success-msg";a:12:{s:16:"background-color";s:0:"";s:6:"border";s
:0:"";s:12:"border-style";s:0:"";s:12:"border-color";s:0:"";s:5:"color";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:0:"";s:7:"padding";s:0:"";s:7:"display";s:0:"";s:8:"advanced";s:0:"";}s:9:"error_msg";a:12:{s:16:"
background-color";s:0:"";s:6:"border";s:0:"";s:12:"border-style";s:0:"";s:12:"border-color";s:0:"";s:5:"color";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:0:"";s:7:"padding";s:0:"";s:7:"display";s:0:"";s:8:"advance
d";s:0:"";}s:5:"title";a:13:{s:16:"background-color";s:0:"";s:6:"border";s:0:"";s:12:"border-style";s:0:"";s:12:"border-color";s:0:"";s:5:"color";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"font-size";s:0:"";s:6:"margin";s:0:"";s:7:"padding";s:0:"
";s:7:"display";s:0:"";s:5:"float";s:0:"";s:8:"advanced";s:0:"";}}}s:15:"email_from_name";s:0:"";s:8:"last_sub";i:153;}
{ form_title: 'Conditional Logic Example',
  show_title: '0',
  save_subs: '0',
  landing_page: '',
  append_page: '',
  clear_complete: '0',
  hide_complete: '0',
  success_msg: '',
  send_email: '0',
  email_from: '',
  email_type: 'html',
  user_subject: '',
  user_email_msg: '',
  user_email_fields: '0',
  admin_subject: '',
  admin_email_msg: '',
  create_post: '0',
  post_logged_in: '0',
  post_as: '0',
  post_status: 'draft',
  post_type: 'post',
  post_tax: { '0': 'category' },
  post_tags: '',
  post_content: '',
  post_content_location: 'append',
  style:
   { groups:
      { container: [Object],
        row: [Object],
        'row-odd': [Object],
        'success-msg': [Object],
        error_msg: [Object],
        title: [Object] } },
  email_from_name: '',
  last_sub: 153 }