I wrote a query and it works fine. But I need some help to edit a part of the php "while".
<?php
require ('db.inc.php');
echo mysql_error();
?>
<form action="#" method="get">
Kundennr: <input type="text" name="nummer" /><br />
<input type="Submit" value="Absenden" />
</form>
<?php
if ($_GET['nummer'])
{
$gruppe = $_GET['nummer'];
echo $gruppe.":<br>";
$result = mysql_query("SELECT catalog_product_entity_media_gallery.value, customer_group_code, catalog_product_entity_varchar.value, sku, qty, catalog_product_entity_tier_price.value FROM `catalog_product_entity_tier_price`
JOIN catalog_product_entity on catalog_product_entity.entity_id = catalog_product_entity_tier_price.entity_id
JOIN customer_group ON customer_group.customer_group_id = catalog_product_entity_tier_price.customer_group_id
JOIN catalog_product_entity_varchar ON catalog_product_entity_varchar.entity_id = catalog_product_entity.entity_id
JOIN catalog_product_entity_media_gallery ON catalog_product_entity_media_gallery.entity_id = catalog_product_entity.entity_id
WHERE customer_group_code = '$gruppe' AND catalog_product_entity_varchar.attribute_id = 71");
while ($row = mysql_fetch_array($result))
{
$bilddaten = $row[0];
$ids = $row[1];
$ids1 = $row[2];
$ids2 = $row[3];
$ids3 = $row[4];
$ids4 = $row[5];
echo "<img src='http://localhost/media/catalog/product/cache/1/thumbnail/60x60/9df78eab33525d08d6e5fb8d27136e95/".$bilddaten."' >";
echo "Art.Nr.: ".$ids2." Bezeichung: ".$ids1." ->Menge: ".$ids3." Preis: ".$ids4."<br><br>";
}
}
?>
My Problem is that I want for the variable $bilddaten only the first value. How can I Edit the while so that take only the first from the value from the $bilddaten?
In the Picture you see the result in the browser. The problem is that row repeated 3 times for each picture URL in the Database. But I need only the first picture for each loop.
Here is the result of the query in the the database. I need only the yello colored. You see in the column with duplicate No. (red-colored): Database result