<code>$current_account_url='<a class="mini-button" iconcls="icon-edit"
onclick="printabc('html/达能益力贸易(深圳)有限公司-[101]广东
2016-04-01-2016-04-30对账单.html')">查看/打印1</a>';
</code>要怎么才可以把它插入表中的字段里呢?搞了好久都没办法。。谢谢了
<code>$sql_url="update tools_current_account set current_account_url='$current_account_url' where Current_unit='$current_unit' and status=1 AND starttime='$starttime' and endtime='$endtime'";</code>
<code>$current_account_url='<a class="mini-button" iconcls="icon-edit"
onclick="printabc('html/达能益力贸易(深圳)有限公司-[101]广东
2016-04-01-2016-04-30对账单.html')">查看/打印1</a>';
</code>要怎么才可以把它插入表中的字段里呢?搞了好久都没办法。。谢谢了
<code>$sql_url="update tools_current_account set current_account_url='$current_account_url' where Current_unit='$current_unit' and status=1 AND starttime='$starttime' and endtime='$endtime'";</code>
我看你的SQL就有问题啊!变量你用单引号引用能把变量的值插入到数据库中吗?
用\'转义。
你的语法没有问题,但是你在$current_account_url赋值的时候出现了问题.单双引号用错了
建议你使用定界符
插入之前用 php base64_encode 下 再插入
或者用mysql hex()之后再插入 避免这些问题
插入数据库可以实用反斜线转义,或者实用base64编码。
但我看你的问题好像是不知道怎么处理$current_account_url的单双引号嵌套。导致$current_account_url那一行一直出错。
嵌套方法也可以使用转义,或下面这样
<code>$current_account_url='<a class="mini-button" iconcls="icon-edit"
onclick="printabc(' . "'" . "html/达能益力贸易(深圳)有限公司-[101]广东
2016-04-01-2016-04-30对账单.html" . "'" . ')">查看/打印1</a>'; </code>
谢谢各位,谢谢@yangxiangming提醒,用addslashes()转义后就可以插入正常读取了
运行的时候难道不报错吗?
$current_account_url="查看/打印1 ";
这样试试.
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号