我从数据库中获取信息,将其保存在数组中,并以具有循环结构的形式回显它,当我尝试将修改后的信息保存到数据库时遇到问题。
我收到此错误:
致命错误:字符串中不支持[]运算符。
码:
$namesql1 = "SELECT name,date,text,date2 FROM table WHERE something= '$something'";
$nameresult1 = mysql_query($namesql1);
$countrows = mysql_num_rows($nameresult1);
while ($row = mysql_fetch_array($nameresult1, MYSQL_ASSOC)) {
$name[] = $row['name'];
$date[] = $row['date'];
$text[] = $row['text'];
$date2[] = $row['date2 '];
}
/** SOME CODE HERE **/
$wrotesql = "UPDATE service_report SET name ='$name' , $date = '$date',$text = '$text[$nro]', ser_date = '$date2[$nro]' WHERE something = '$something')";
$wroteresult = mysql_query($wrotesql);
有人可以给我一个提示我做错了什么吗?
谢谢。
慕哥9229398