您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

一下sql查询代码放入php为什么会空白呢?

2024/3/22 12:28:55发布15次查看
吧这段sql查询语句放入php就会空白是为什么呢?
语句在mysql查询没问题,可以显示查询结果的.
$sql = mysql_query('select attach.* , category.* from attach, category where attach.id = substring_index(substring_index(substr(category.ext,locate('attach',category.ext)),'',4),'',-1) order by rand() limit 5');
如果去掉
 substring_index(substring_index(substr(category.ext,locate('attach',category.ext)),'',4),'',-1)
就没问题,怎么解决呢?
回复讨论(解决方案) 你在被单引号括起的串中使用了未转义的单引号,难道不报错吗?
$sqlstr = select attach.* , category.* from attach, category where attach.id = substring_index(substring_index(substr(category.ext,locate('attach',category.ext)),'',4),'',-1) order by rand() limit 5
sql;
$sql = mysql_query($sqlstr);
谢谢啊
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product