Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
mssql qery click here for picture <ahref>http://img521.imageshack.us/img521/9280/sqlsecreen.png[^]
and my output shows three different pictures for the same product as shown below. What I want is, if the product is the same, keep just one picture and then get the colors and sizes for that product.

Means;

My output ıs the picture below,
http://jsfiddle.net/hanifeoglu/F8Nk9/[^]

http://imageshack.us/photo/my-images/85/tablex.png/[^]

as you see there are three product in the picture but they are the same product with different colors and sizes, instead of seeing the same product every time, I want my output like in the picture below.

click here for picture
http://img337.imageshack.us/img337/1445/while.png[^]

PHP
<table width="376" cellspacing="0"  class="stats" width:100%> 
<tr> 
<td colspan="9" align="center"><?php echo $secim ?></td> 
</tr> 
<?php 
while(odbc_fetch_into($sql_result, &$row)) { 
$unit1 = floor($row[3]); 
$unit2 = floor($row[4]); 
$unit3 = floor($row[5]); 
$unit4 = floor($row[6]); 
$unit5 = floor($row[7]); 
?> 
<tr> 
  <td colspan="2" align="left" valign="top"><?php echo"$row[0]";?></td> 
  <td>36</td> 
  <td>38</td> 
  <td>40</td> 
  <td>42</td> 
  <td>44</td> 
</tr> 
<tr>       
<td width="114" align="right" valign="top">
<img src= <?php echo"images/Resize/$row[2]"?>></td> 
 <td width="25" valign="top"><?php echo"$row[1]";?></td> 
 <td width="25"valign="top"><?php echo"$unit1";?></td> 
 <td width="25"valign="top"><?php echo"$unit2";?></td> 
 <td width="25"valign="top"><?php echo"$unit3";?></td> 
 <td width="25"valign="top"><?php echo"$unit4";?></td> 
 <td width="25"valign="top"><?php echo"$unit5";?></td> 
 </tr> 
 <?php }  }?> 
 <?php  
 odbc_free_result($sql_result); 
 odbc_close($connection); 
 ?> 
 </table>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900