我将下面的数据反序列化
a:7:{s:12:"existingname";s:0:"";s:12:"originalname";s:50:"165074-mort-de-l-historien-jean-pierre-vernant.jpg";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:4:"desc";s:0:"";s:6:"delete";b:0;s:6:"remove";b:0;}
使用此引用
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(value,';',4),':',-1) AS bookimage
FROM jksid_flexicontent_fields_item_relations
WHERE jksid_flexicontent_fields_item_relations.field_id = 17
AND jksid_flexicontent_fields_item_relations.ite m_id = 13153
我的结果是
"165074-mort-de-l-historien-jean-pierre-vernant.jpg"
如何删除"
符号?
答案 0 :(得分:2)
尝试使用replace功能。
例如:REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(value,';',4),':',-1), '\"', '')
答案 1 :(得分:2)
SELECT REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(value,';',4),':',-1),'"','') AS bookimage
FROM jksid_flexicontent_fields_item_relations
WHERE jksid_flexicontent_fields_item_relations.field_id = 17
AND jksid_flexicontent_fields_item_relations.ite m_id = 13153
答案 2 :(得分:0)
我想我再次叠加
当我在报价上复制时,我有语法错误
<?php
// get book image
mysql_select_db($database_fsd, $fsd);
$query_wrtbkimg = "
SELECT REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(value,';',4),':',-1),'"','') AS bookimage
FROM jksid_flexicontent_fields_item_relations
WHERE jksid_flexicontent_fields_item_relations.field_id = 17
AND jksid_flexicontent_fields_item_relations.ite m_id = 13153
";
$wrtbkimg = mysql_query($query_wrtbkimg, $fsd) or die(mysql_error());
$row_wrtbkimg = mysql_fetch_assoc($wrtbkimg);
$totalRows_wrtbkimg = mysql_num_rows($hwrtbkimg);
?>