开发者

Retrieving records from mysql [closed]

开发者 https://www.devze.com 2023-04-04 14:01 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

开发者_如何学编程 Improve this question

Just looking for better solution.I'm retrieving all the records from mysql. Then I will send this data by email. Its working fine. Is there any better solution? thanks

$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>";
    }


You would benefit from: http://us.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

Instead of the complicated string manipulation you are doing now.

You are setting $row, but using $data?


I would take a look at the following to improve your code.

mysql-real-escape-string

SELECT * vs SELECT column

0

精彩评论

暂无评论...
验证码 换一张
取 消