我有这个
UPDATE table
SET example = REPLACE(example, '1', 'test')
WHERE example REGEXP '1$'
Run Code Online (Sandbox Code Playgroud)
因此,此代码将"example"字段中的所有"1"实例替换为"test".
我想重复2,3,4等等.
但是使用单独的查询会非常低效.
我只用一个查询就能做到这一点吗?
谢谢
这有效
$source = simplexml_load_file('data.xml');
foreach ($source->programme as $programme) {
echo $programme->title . "<br />";
}
Run Code Online (Sandbox Code Playgroud)
但事实并非如此
$source = simplexml_load_file('data.xml');
foreach ($source->programme as $programme) {
echo $programme->sub-title . "<br />";
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
"注意:使用未定义的常量标题 - 假定'标题'在......"
此错误可能是由于在第二个代码段中使用" - "引起的.
我的问题是:我可以逃脱破折号角色并使其发挥作用吗?