吧这段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);
谢谢啊
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号