There are a few things that don't make sense about your example. First, you can't use a name with mysql_fetch_array when retrieving the result. Mysql_fetch_array uses the numeric indices, not the column name. Second, you don't return a value from within a looping while statement. You'd either build up a string or echo it as you're progressing through the loop.
Have you tried something like this:
$counter = 1;
while ($subject = mysql_fetch_array($subject_qry)) {
echo "<div class=\"left\" id=\"{$subject[0]}\"></div>";
mysql_data_seek($subject_qry,$counter);
$subject = mysql_fetch_array($subject_qry);
echo "<div class=\"right\" id=\"{$subject[0]}\"></div>";
$counter=$counter+2;
}
mysql_*functions in new code. They were removed from PHP 7.0.0 in 2015. Instead, use prepared statements via PDO or MySQLi. See Why shouldn't I use mysql_* functions in PHP? for more information.