Hi all!
I got troubles while inputting data in table from mysql query. Here is the code:
[code]
$sql_2 = “SELECT name FROM product_attributes WHERE cid=$category_id ORDER BY order_field AND id”;
$result_2 = mysql_query($sql_2) or die(“2”.mysql_error());
while($atribute = mysql_fetch_assoc($result_2)){
echo “<tr>”;
foreach ($atribute as $k=>$v){
echo “<td>”;
echo $v;
echo “</td>”;
foreach($_SESSION[‘ident’] as $ident){
if(isset($_GET[$ident])){
$temp_id = $ident;
$sql_3 = “SELECT val_string FROM product_attribute_values WHERE product_id=$ident ORDER BY id”;
$result_3 = mysql_query($sql_3) or die(“3”.mysql_error());
while($value = mysql_fetch_assoc($result_3)){
foreach($value as $stoinost){
echo “<td>”;
echo $stoinost;
echo “</td>”;
}
break;
}
}
}
break;
}
}
I want them to be outputted like this:
[code]
|product 1| product 2
attribute1 | value.1 | value.1
attribute1 | value.2 | value.2
attribute1 | value.3 | value.3
but they are outputting like this:
[code]
|product 1| product 2
attribute1 | value.1 | value.1
attribute1 | value.1 | value.1
attribute1 | value.1 | value.1
Where i’m wrong with my code? Can someone help me out?
Thanks in advance!