我收到错误*您的SQL语法有错误;检查与MySQL服务器版本相对应的手册以获取正确的语法,以便在尝试更新和发送电子邮件时在第1 *行的'[0]'附近使用。

$updatelist = explode(",",$Limited);
print_r($updatelist); // echos Array ( [0] => [email protected] [1] => [email protected] [2] => )

$totalupdates = count($updatelist)-1;
for ($y = 0; $y < $totalupdates; $y++)
{
  $updatemail = "UPDATE tblusers SET date= '$date' WHERE Email = 'updatelist[$y]'";
  $updatefree = mysql_query($updatemail);

  echo $updatemail;

}


$ updatelist [$ y]有什么问题?是否应该通过$ updatelist [0]到$ updatelist [1]循环?

最佳答案

我认为问题出在这里:

$updatemail = "UPDATE tblusers SET date= '$date' WHERE Email = 'updatelist[$y]'";


尝试这个:

$updatemail = "UPDATE tblusers SET date = '$date' WHERE Email = '$updatelist[$y]'";

关于php - 数组语法错误PHP,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21059848/

10-12 00:05