2012-12-29 7 views
-3

이 코드를 가지고 ...(예상치 못한 T_Error ...)

<? 
$sql = "SELECT * FROM products where category =". $ID ; 
$result = @mysql_query($sql); 
while ($row=mysql_fetch_array($result)) 
{ 
?> 

<table width="810" valign="center"> 
<tr height="100px"> 

<td width="150px"><img src="<?php echo($row['imagethumb']) ?>" width="150" height="100" border="0" /></td> 

<td width="200px"><h3><a href='item.php?id=<?php echo($row['id']) ?>'> <?php echo($row['title']) ?></a></h3></td> 

<td width="200px"><h4>$<?php echo($row['price']) ?></h4> </td> 

<td><h4><a href="<?php echo($row['cartlink']) ?>"><span class="addtocart"></span></a></h4></td> 
</tr> 
</table> 


<? 
} 
?> 

와 나는 가격 내 결과를 정렬하고 싶습니다. 지금까지 나는 ASC가 작동하도록 ORDER BY '가격'을 얻을 수있었습니다. 도움말은 대단히 감사하겠습니다.

+3

을 받고있는 전체 오류를 prvide하십시오. 기본 PHP 구문 오류와 같습니다. – RandomSeed

+0

구문 분석 오류 : 예기치 않은 구문 오류 T_STRING /home/content/33/7377933/html/updates/products/index.php 온라인 51 –

+0

이것은 ORDER BY 가격 ASC를 "where category ="뒤에 추가 할 때만 발생합니다. $ ID " –

답변

2

이 시도 :

$sql = "SELECT * FROM products where category ='".$ID."' order by columnname ASC " ; 
+0

이것은 무능함으로 인해 유감스럽게 생각합니다! 정말 고마워요! –