我只想从客户表中获取一封电子邮件并将消息发送到该电子邮件。我收到此错误
“警告:mysql_num_rows() 期望参数 1 是”
我的代码如下:
<?php
$mysql = mysql_connect("localhost", "hname", "passs", "dbname");
$getusers = mysql_query("SELECT * FROM customer");
while ($row = mysql_fetch_array($result)) {
sendMail($row['email']);
}
mysql_free_result($result);
function sendMail($to){
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>