2011-09-14 12 views
0

더 나은 솔루션을 찾고 있습니다. mysql에서 모든 레코드를 검색하고 있습니다. 그런 다음이 데이터를 이메일로 보내 드리겠습니다. 잘 작동합니다. 더 나은 해결책이 있습니까? 감사mysql에서 레코드 가져 오기

$query = "SELECT * FROM order_details WHERE order_id = '".$data['order_id']."'"; 
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { 
    $message_admin .= "<table style='text-align:center;' border='1' cellspacing='0' cellpadding='7'> 
     <tr> 
      <td>Source</td> 
      <td>".$data['source']."</td> 
     </tr> 
     <tr> 
      <td>Email</td> 
      <td>".$data['email']."</td> 
     </tr> 
     <tr> 
      <td>Message</td> 
      <td>".$data['message']."</td> 
     </tr> 
     <tr> 
      <td></td> 
      <td></td> 
     </tr> 
    </table>"; 
    } 
+0

어떤 방법으로 더 나은? 그리고 SQL 쿼리를 포함하여 전체 코드를 게시하려고합니다. – TJHeuvel

+0

왜이 점이 잘못 되었나요? –

+0

당신이 "더 나은"의미하는 바에 달려 있습니다 – symcbean

답변

0

당신은에서 도움이 될 : http://us.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

대신 당신이 지금하고있는 복잡한 문자열 조작의.

$ row를 (를) 설정했지만 $ data?

+0

이 변수를 인쇄 할 때. 'echo $ message_admin'. 그것은 데이터를 표시합니다. 이 변수를 메일에 전달하고 있습니다. 그리고 나는 비어있는 메시지를 얻고있다. 이 코드가 잘못된 것은 무엇입니까? '$ row' 오류를 지적 해 주셔서 감사합니다. –

+0

메일 기능'$ headers = 'MIME-Version : 1.0'. "\ r \ n"; \t \t \t \t \t \t $ headers. = 'Content-type : text/html; charset = iso-8859-1 '. "\ r \ n"; \t \t \t \t \t \t 메일 ($ to_client, $ subject_client, $ message_admin, $ 헤더),' –

+0

나는 무엇이 잘못되었는지 모르겠어요. PHP로 간단한 테스트 메시지를 보낸 다음 작성한 코드를 넣으십시오. – Ariel

관련 문제