I'm getting information from database, saving it in array and echoing it in a form with loop structure and I'm having problems when I try to save the modified information to database.
I'm getting this error:
Fatal error: [] operator not supported for strings in....
Code:
$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);
Could somebody please give me a hint what I'm doing wrong?