我在 Magento 的 PHP 中有以下代码,它试图将特定文件中的连接值插入到一个表中
$extencion = '.jpg';
$test ='/small/';
$_prodId= 1;
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "update catalog_product_entity_varchar
set value = ".$test.$_prodId.$extencion."
where entity_id = ".$_prodId."
and attribute_id = 86 ";
$result = $conn->query($sql);
我尝试在更新前连接值
$concatenate = $test.$_prodId.$extencion;
但是没有成功,知道如何解决这个问题吗?
最佳答案
你必须在引号中插入字符串:
$sql = "update catalog_product_entity_varchar
set value = '".$test.$_prodId.$extencion."'
where entity_id = ".$_prodId."
and attribute_id = 86 ";
关于php - Mysql更新串联变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27639016/