You need to pass the screen width in numeric format to $screenwidth . Is this possible in this example? Or do you need to transfer to $_GET['width'] and take values from there? Thank.
$screenWidth= '<script> document.write(screen.width); </script>'; if ( $screenWidth >= 1367) { $num_of_adds = 15; $num_of_td = 3; } else { $num_of_adds = 10; $num_of_td = 2; }