我正在尝试运行一个更新,它根据多个变量为 varchar 分配一个巨大的数据块。这是我的 sql 代码示例:
'update details set full = "Miles reported by $name - $empname - $deptname\n\n"
"Total Miles in $month: $dailytotal\n"
"Total Business Miles in $month: $busitotal\n"
"Total Personal Miles in $month: $perstotal\n\n"
"$month 1: START: $start1...STOP: $stop1...DAILY: $daily1...BUSINESS: $busi1...PERSONAL: $personal1\n"
"$month 2: START: $start2...STOP: $stop2...DAILY: $daily2...BUSINESS: $busi2...PERSONAL: $personal2\n"
')
or die "Could not prepare sql statement";
效果很好,但问题在于它将变量存储为“$name”,而不是 $name 与所有其他变量一样。我该如何解决这个问题,并对我的格式感到抱歉。提前致谢!