I am having problems trying to create a php script which will detect a visitors screen width/resolution and Insert it as a mysql record. This example shows roughly what I am trying to achieve
/ Database configurations /
$screenwidth = "<html><script type='text/javascript' language='JavaScript'>var resolution =screen.width;document.write(resolution);</script></html>";
$sql = "
INSERT INTO $table_name
(screenwidth)
VALUES
('$screenwidth')
";
etc. etc.
For some reason this query fails. I have tried to echo() the $screenwidth just to make sure that it contains a value, which it does, so that bits OK. I've also tried assigning a different value to screenwidth to check my SQL syntax is OK and that works fine.
The query I am trying to run though always fails. Could anyone help me on this.
Thanks
Rob