Forum Moderators: coopster
How to store each value in array and than store in db each separate value by sign: '',''
Example:$accept_charset has:
accept=ISO-8859-2,utf-8;q=0.7,*;q=0.7
$http = array(); // initialize it
$http['accept'] = $_SERVER["HTTP_ACCEPT"];
$http['user_agent'] = $_SERVER["HTTP_USER_AGENT"];
$http['accept_charset'] = $_SERVER["HTTP_ACCEPT_CHARSET"];
$http['accept_language'] = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
$http['x_wap_profile'] = $_SERVER["HTTP_X_WAP_PROFILE"];
$http['profile'] = $_SERVER["HTTP_PROFILE"];
$serializedHttp = serialize($http);
$http = unserialize($row['yourTableColumn']);
<?
$page='http://www.mydomain.com/';
preg_match('/<title>([^<]+)</title>/', $page, $matches);
$http = array(); // initialize it
$http['accept'] = $_SERVER["HTTP_ACCEPT"];
$http['user_agent'] = $_SERVER["HTTP_USER_AGENT"];
$http['accept_charset'] = $_SERVER["HTTP_ACCEPT_CHARSET"];
$http['accept_language'] = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
$http['x_wap_profile'] = $_SERVER["HTTP_X_WAP_PROFILE"];
$http['profile'] = $_SERVER["HTTP_PROFILE"];
$serializedHttp = serialize($http);
//will be available as an array on the server.
session_start();
$db_host = "localhost";
$db_name = "...";
$db_username = "...";
$db_password = "...";
$conn = mysql_connect($db_host,$db_username,$db_password) or die("Could not connect to Server" .mysql_error());
mysql_select_db($db_name) or die("Could not connect to Database" .mysql_error());
$serializedHttp= serialize($http);
$query = "INSERT INTO globalvar VALUES ('','$matches','$accept','$user_agent','$accept_charset','$x_wap_profile','$profile')";
mysql_query($query) or die("query: $query<br>" . mysql_error());
mysql_close();
//unserialize it and the variables you have stored are once again in your array
$http = unserialize($row['globalvar']);
?>