У меня есть php-скрипт, который вызывает серию изображений, которые отображаются так:

Это код PHP, который их вызывает:
<?php
$query = "SELECT
parent_business_id,
image_url,
alt_tag,
description,
thumb_url,
business
FROM
images
ORDER BY
RAND()
LIMIT
6
";
$result = mysql_query($query, $dbc)
or die (mysql_error($dbc));
while($row = mysql_fetch_array($result)) {
$parent = $row["parent_business_id"];
$image = $row["image_url"];
$alt = $row["alt_tag"];
$description = $row["description"];
$thumb = $row["thumb_url"];
$business = $row["business"];
$mainthumb = "./images/270x270/$image.jpg";
echo
"<div class='gallery_image_container'>
</div>";
}
?>
At the moment I am using css3's nth-child to add margins to the central images:
div.gallery_image_container:nth-child(3n+2){
margin-left:10px;
margin-right:10px;
}
The problem I have is this works great in browsers that support css3 but ie 7 and ie 8 will not and I need a solution. I am thinking that maybe I can do this by adding classes in php. If so which function would I use. Is there an nth-child like selector in php?