选择查询不给我值

时间:2019-06-03 23:02:08

标签: php select

好的,我正在使用以下代码向我的假设网站的用户发送一封包含一些详细信息的电子邮件。

$sql = 'SELECT * FROM ads WHERE type="Offer" AND category ="' 
.$_POST['category']. '" AND details LIKE "%'.$_POST['details']. 
'%"';

 $r = mysqli_query ($conn, $sql);

 $maxMails = 3;
$count = 0;

while ($r && $d = mysqli_fetch_assoc($r) && $count < $maxMails) {

  $to      = mysqli_fetch_array ($conn->query ('SELECT email FROM publishers WHERE login_name="'. $_COOKIE ['user_username']. '"'), MYSQLI_ASSOC)['email'];
  $subject = 'New ad that may interest you';
  $message = 'Type: '.$d['type']."\r\n".'Category: '.$d['category']."\r\n".'Details: ' .$d['details'];

  mail($to, $subject, $message);

  $count++;
}

但是$d ['nameOfVariable']都没有在邮件中提供任何值。我在做什么错了?

0 个答案:

没有答案