2012-03-31 3 views
0

게임 서버를 실행하고 게임 서버에 항목을 표시하는 테이블을 만들었습니다. 테이블에서이를 지우지 만 문제는 "GMP"라는 항목이 스팸으로 표시된다는 것입니다. 왜냐하면 사람들이 많이 verry를 얻었 기 때문입니다.테이블에서 특정 이름을 제외하는 방법

내가 원했던 것은 전체 테이블에서 "GMP"항목을 제외시키는 것이지만 나는 그것을 테이블에서 꺼내지 못했습니다.

http://puu.sh/nefH. 이것이 그 모습입니다. 다음은 소스 코드에서이를 보여주는 부분입니다.

print <<<END 
<br> 
<table border="1"> 
<tr> 
<th>Item</th> 
<th>+</th> 
<th>Damage -</th> 
<th>Extra hp</th> 
<th>Position</th> 
</tr> 
END; 


$sql6 = "SELECT t.name, i.position, p.position, i.type, i.magic3, i.reduce_dmg, i.add_life FROM cq_item i, position p, cq_itemtype t WHERE t.id = i.type AND p.id = i.position AND player_id = $id2 ORDER BY name ASC"; 
$execute6 = mysql_query($sql6); 
while ($exibir6 = mysql_fetch_array($execute6)){; 

print "<tr>"; 

print "<td>".$exibir6 ['name']."</td>"; 
print "<td>".$exibir6 ['magic3']."</td>"; 
print "<td>".$exibir6 ['reduce_dmg']."</td>"; 
print "<td>".$exibir6 ['add_life']."</td>"; 
print "<td>".$exibir6 ['position']."</td>"; 

print "</tr>"; 


} 
print <<<END2 
</table> 
END2; 

다른 것이 필요한 경우 알려 주시면 여기에 추가하겠습니다.

내 영어로 죄송합니다. 모국어가 아닙니다.

$sql6 = " 
    SELECT t.name, i.position, p.position, i.type, i.magic3, i.reduce_dmg, i.add_life 
    FROM cq_item i, position p, cq_itemtype t 
    WHERE t.id = i.type AND p.id = i.position AND player_id = $id2 AND t.name != 'GMP' 
    ORDER BY name ASC"; 

주의 :

+0

나는 왜 그 데이터가 표시되어서는 안되는 지 궁금합니다. 왜 당신이 그들을 삭제하지 않는 이유가 무엇입니까? –

답변

1

그 이름 (즉에 대한 사용 WHERE)와 항목을 선택하지 마십시오. 이스케이프/쿼리 변수를 올바르게 캐스팅하십시오.

+0

정말 빠른 답변 주셔서 감사합니다. 이것은 나를 위해 일했다. 나머지는 정상적으로 잘 작동합니다. 다시 한번 감사드립니다. – Arthur1472

1
$sql6 = "SELECT t.name, i.position, p.position, i.type, i.magic3, i.reduce_dmg, i.add_life FROM cq_item i, position p, cq_itemtype t WHERE t.id = i.type AND p.id = i.position AND player_id = $id2 AND t.name != 'GMP' ORDER BY name ASC"; 
0

루프에서 if 문을 수행하십시오.

<?php 
while ($exibir6 = mysql_fetch_array($execute6)){ 
    if($exibir6['name'] != 'GMP') { 
    // Add to table 
    } 
} 
?> 
관련 문제