$mybase = mysql_query("SELECT * FROM customers WHERE id!='$pid'");
$y = array();
while($db = mysql_fetch_assoc($mybase)) $y[$db['y']] = $db;
ksort($y);
foreach ($y as $_y=>$db){
//запихиваем данные из строк в <img>
$all = "<img src='{$db['loc']}' width='50' height='50' id='{$db['name']}' name='{$db['name']}' style='position: absolute; left:{$db['x']}; top:$_y'></img>";
//слой
$isbnTextq1 = $dom->createTextNode($all);
$one->appendChild($isbnTextq1);
}