update문 관련 질문입니다. 0 1 1,266

by 고주형 [MySQL] PHP MySQL DB update문 [2015.11.17 23:54:38]


$chart = mysql_query("select sname, snumber, result from student");

      while ($row = mysql_fetch_row($chart))
      {
         $one = $row[0];
         $two = $row[1];
         $three = $row[2];

         echo "$one $nbsp";
         echo "$two $nbsp";
         echo "$three $nbsp<br>";

         $a = mysql_query("select type, num from pie");
         if ($row[2]<0)
         {
            echo "BAD : $nbsp$nbsp $row[0]<br> ";
            $q1 = "update stuednt set type = 'bad' where sname = '". $row[0] ."'";
            $result = mysql_query($ql);
            if ($result) echo "success<br>";
         }
         if ($row[2] < 4 && $row[2] >= 0)
         {
            echo "OUT : $nbsp$nbsp $row[0]<br> ";
            $q1 = "update stuednt set type = 'out' where sname = '". $row[0] ."'";
            $result = mysql_query($ql);
            if ($result) echo "success<br>";

         }
         if ($row[2] < 10 && $row[2] >= 4)
         {
            echo "MID : $nbsp$nbsp $row[0]<br> ";
            $q1 = "update stuednt set type = 'mid' where sname = '". $row[0] ."'";
            $result = mysql_query($ql);
            if ($result) echo "success<br>";
         }
         if ( $row[2] >= 10)
         {
            echo "STAR : $nbsp$nbsp $row[0]<br> ";
            $q1 = "update stuednt set type = 'star' where sname = '". $row[0] ."'";
            $result = mysql_query($ql);
            if ($result) echo "success<br>";
         }
      }

student 테이블 안에서 result필드값을 비교해서 type 필드안에 update문을 써서 문자를 집어 넣으려고 하는데 안됩니다...

도와주세요 형님들!

by 손님 [2015.12.10 16:49:03]
이런말 안하려고 했는데...
$ql(문자)인지 $q1(숫자) 확인해보세요
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입