将Google地图代码插入表格列

时间:2012-07-29 18:26:25

标签: sql google-maps

我使用此查询

$sq="UPDATE `contact` SET `".$pType."`='".$content."'";

它工作正常但直到我将此代码输入文本区域:

<iframe width="710" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Yenimahalle,+Gersan,+Ankara,+T%C3%BCrkiye&amp;aq=0&amp;oq=gersan+&amp;sll=39.982382,32.760887&amp;sspn=0.157578,0.308647&amp;ie=UTF8&amp;hq=&amp;hnear=Bat%C4%B1+Sitesi+Mh.,+Gersan,+Ankara%2FYenimahalle,+Turkey&amp;t=m&amp;ll=39.955543,32.696342&amp;spn=0.029607,0.060854&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Yenimahalle,+Gersan,+Ankara,+T%C3%BCrkiye&amp;aq=0&amp;oq=gersan+&amp;sll=39.982382,32.760887&amp;sspn=0.157578,0.308647&amp;ie=UTF8&amp;hq=&amp;hnear=Bat%C4%B1+Sitesi+Mh.,+Gersan,+Ankara%2FYenimahalle,+Turkey&amp;t=m&amp;ll=39.955543,32.696342&amp;spn=0.029607,0.060854&amp;z=14&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>

它更新但缺少信息;

像这样:

<iframe width="710" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q

可能出现什么问题?我被卡住了,因为我看不到任何东西。

1 个答案:

答案 0 :(得分:0)

在将数据放入表格时使用urlencode函数,然后在拉出时使用urldecode函数。这将摆脱所有的&符号。

$ sq =“UPDATE contact SET”。$ pType。“='”。 urlencode($ content)。“'”;