2010-11-24 7 views
-1

아래의 전자 메일 쿼리는 "ttemail"이라는 필드가 0 일 때 트리거됩니다. 사용하려고하면 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1이 표시됩니다.IF 문으로부터의 MySQL 오류

이메일이 적어도 최초의 사용자 이름 어디 TTEMAIL (으) = 0

어떤 아이디어 이유를 보내는 것 같습니다? 사전에

감사합니다,

if($row["ttemail"] == 0){ 
    $mailaddress = $row['email']; 
    $link1 = "<a href='http://www...com/page.php'>Page Title</a>"; 
    $message1 = "Congratulations, message. 

       <br> 
       <br> 

       More Message 

       <br> 
       <br> 

       Please click the link below to see more. 
       <br> 
       <br> 

       $link1 
       ";  

    $headers = 'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    $headers .= "From: Website Name <[email protected]>" . "\r\n"; 

    $queryem = mail($mailaddress, "Congratulations, message 
          $submission.", $message1, $headers); 

    //$ttquery = sprintf("Update login SET ".$row['ttemail']." = '1' WHERE username = ".$row['username']."");   

    mysql_query($queryem) or die(mysql_error()); 
    mysql_query($ttquery) or die(mysql_error()); 
} else { 
} 
+3

잠깐, 뭐라 구요? MySQL 쿼리로'mail()'호출의 반환 값을 사용하고 있습니까 ??? – EboMike

+2

부울을 쿼리로 사용 하시겠습니까 ?? = P – MatTheCat

+1

어제 같은 질문을하지 않았고 그 질문에서 무의미한 PHP 소스 코드 대신 생성 된 쿼리를 보여달라고 요청하지 않았습니까? –

답변

0

나는 당신이 '당신의 where 절에 누락 생각합니다. 아래의 수정 된 쿼리를 확인하십시오.

$ttquery = sprintf("Update login SET ".$row['ttemail']." = '1' WHERE username = '".$row['username']."'");