첫 번째, 두 번째 및 세 번째에 대해 동일한 값을 얻고 있습니다. 다음 줄은 제 1 행에있는 두 번째 열에 있어야하는 결과를 나에게줍니다.쿼리가 3 행에 대해 동일한 데이터를 반환합니다.
<?php
require "db.php";
$sql = "select n_name, shortcut, IF(rank = 1>2, 2, shortcut) AS 1st, IF(rank = 1<2, shortcut, shortcut) AS 2nd,
IF(rank = 3=3, 1, shortcut) as 3rd from team inner join nonsport on team.n_id = nonsport.n_id";
$con = mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
$result = mysqli_query($con,$sql);
$response = array();
while($row=mysqli_fetch_array($result))
{
array_push($response, array("n_name"=>$row[0],"1st"=>$row[1],
"2nd"=>$row[2], "3rd"=>$row[3]));
}
echo json_encode (array("nresults"=>$response));
mysqli_close($con);
?>
내 예상 출력은
예이다. 바로 가기는 a, b, c를 가지며 순위 a = 1 b = 2 c = 3;
그러면 1st = a, 2nd = b, 3rd = c;
은 무엇 메신저 점점
1 = A, 2 = A, 3 =이다;
은 그 다음 줄은
1 = B를, 2 = B를, 3 = B를 보여줍니다; 다음과 같이
'rank = 1 <2' ?? 이것이 의도 한 것은 무엇입니까? – GurV
난 그냥 그 선생님을 시도 – orange