입니다. phpmyadmin에서 제 SQL을 테스트 해봤는데 SQL은 잘 작동합니다. 그러나 폼 버튼을 통해 호출 할 때 아무 것도하지 않습니다. 누구나 내가 뭘 잘못하고 있는지 아이디어를 줄 수 있을까? PHP로 MySQL 레코드 업데이트하기 - SQL은 작동하지 않습니다. PHP 쪽은
<?php
echo
"<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
<th>health</th>
<th>damage</th>
</tr>";
while($row = mysql_fetch_row($result)) {
echo '<tr>';
foreach($row as $cell) {
echo "\n<td>$cell</td>";
}
echo '<td><form method="POST" action="attack.php">
<input name="update" type="button" value="Update Record" />
<input type="hidden" name="'.$row[1].'" /></form></td></tr>';
echo "\n\n";
echo "test";
}
?>
<?php
require_once('config.php');
$sqltest = $sqltest - 5;
$id = floor($_GET['id']);
if($id > 0)
{
$sql1="UPDATE ajax_demo SET Health = Health - Damage";
$result=mysql_query($sql1);
mysql_close();
}
?>
가 obvisouly 내가 SQL 문자열 nito하지만 난 같은 그것을 왼쪽 테스트 목적으로 varibles를 추가 :
이
은 기본 폼 페이지에서 PHP입니다. 누구든지 도움이된다면 많은 도움이 될 것입니다.
$ SQL1 =을 사용하는 경우이 쿼리
; 변경하십시오. – Dgo
1) HTML로 삽입 할 때 값을 이스케이프 처리하지 않습니다. 2) mysql_query()가 성공했는지 확인하지 않는다. 3) 더 이상 사용되지 않는 확장 프로그램을 사용 중입니다. –
Álvaro G. Vicario 그 지점까지 연장 할 수 있습니까? – user1284386