$pieces = explode(">", $position);
if ($pieces[0] != "")
{
$result = mysql_query("SELECT * FROM cats
WHERE cats_id='$pieces[0]'");
while($row = mysql_fetch_array($result))
{
$piecesid0 = $row['cats_id'];
$piecesname0 = $row['cats_name'];
$piecesposition0 = $row['cats_position'];
}
}
if ($pieces[1] != "")
{
$result = mysql_query("SELECT * FROM cats
WHERE cats_id='$pieces[1]'");
while($row = mysql_fetch_array($result))
{
$piecesid1 = $row['cats_id'];
$piecesname1 = $row['cats_name'];
$piecesposition1 = $row['cats_position'];