Hello,
I would like to start by saying that I am very new to PHP, so please forgive me if I am missing something stupid here. I am trying to use a webhook to pull the information from my Unbounce.com landing page and store it on an external MySQL database. I cannot figure out why the data is not storing. Can someone please help me with this?
[php]<?php
define(‘DB_NAME’, ‘sisbro_sav-unbounc’);
define(‘DB_USER’, ‘sisbro_unbounc’);
define(‘DB_PASS’, ‘xxx’);
function db_unbounce_log($data)
{
$db = new mysqli(‘localhost’, DB_USER, DB_PASS, DB_NAME);
if ( ! mysqli_connect_errno())
{
$data[‘name’] = $db->real_escape_string($data[‘name’]);
$data[‘email’] = $db->real_escape_string($data[‘email’]);
$data[‘phone’] = $db->real_escape_string($data[‘phone’]);
$data[‘city_state’] = $db->real_escape_string($data[‘city_state’]);
$data[‘years_of_experience’] = $db->real_escape_string($data[‘years_of_experience’]);
$data[‘referrer’] = $db->real_escape_string($data[‘referrer’]);
$sql = "INSERT INTO `unbounce_log` (name, email, phone, city_state, years_of_experience, referrer) VALUES ";
$sql .= sprintf("('%s', '%s', '%s', '%s', '%s', '%s',)", $data['name'], $data['email'], $data['phone'], $data['city_state'], $data['years_of_experience'], $data['referrer']);
$db->query($sql);
$db->close();
}
}
?>[/php]