var products = [
{"id": "1", "name": "Имя1"},
{"id": "2", "name": "Имя2"},
{"id": "3", "name": "Имя3"}
];
var html = '<table>';
var cnt = 0;
for(var i in products) {
if(cnt == 0) {
html += '<tr>';
}
html += '<td>'+products[i]['id']+'</td>' + '<td>'+products[i]['name']+'</td>';
cnt++;
if(cnt == 2) {
cnt = 0;
html += '</tr>';
}
}
if(cnt != 0) {
html += '<td></td><td></td></tr>';
}
html +='</table>';
session_start();
$_SESSION['access'] = TRUE;
session_start();
if (! isset($_SESSION['access']))
{
echo 'Your text of error.';
exit(0);
}
unset($_SESSION['access']);