用变量更新joomla数据库

时间:2018-03-24 06:10:16

标签: php mysql joomla

我尝试过使用Joomla Framework,我的更新工作正常,但如何使用变量进行更新。 Fx的:

$test = 'Hello';
$fields = array(
$db->quoteName('test_column') . ' = ' . $db->quote('$test')
);

如何在此行中编写$test变量?

1 个答案:

答案 0 :(得分:0)

In php, you want to single quote (') strings when you want to output them as you see them, and double quotes (") when you want the string to be parsed for variables. All you need to do is change the quotes around $test , or more simply remove them as they aren't needed here:

$test = 'Hello';
$fields = array(
  $db->quoteName('test_column') . ' = ' . $db->quote($test)
);