联系官方销售客服

1835022288

028-61286886

开发框架 版主:迅睿框架研发组
我语句条件语句是这个答位于位置下面是小编个人整理的位置地图希
类型:迅睿CMS 更新时间:2021-02-03 16:47:33

我sql语句条件语句是这个

{sql sql='select * from @#1_school where id={$t.diaoqu1}'} 
<div class="ycasedet_info" id="dianhua">
<p>答:{$t.dianqu1}位于{$t.dizhi}位置,下面是小编个人整理的位置地图,希望可以帮助到您</p><p><img src="{dr_get_file($t.weizhitupian)}" alt="{$t.title}位置图" /></p>
</div>
{/sql}

报错是这个

ERROR - 2021-02-03 10:30:05 --> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=<?php echo ; ?>' at line 1
#SQL:select * from dr_1_school where id=<?php echo ; ?>
#URL:http://wz.entem.cn/index.php?s=schoolnews&c=html&m=show&catids=2&pp=1
#AGENT:Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
#REFERER:http://wz.entem.cn/admin.php?c=html&m=show_index&app=schoolnews&pagesize=10&id_form=&id_to=&date_form=&date_to=&catids[]=2
#0 /wwwroot/xunruiCMS/dayrui/System/Database/MySQLi/Connection.php(314): mysqli->query()
#1 /wwwroot/xunruiCMS/dayrui/System/Database/BaseConnection.php(697): CodeIgniter\Database\MySQLi\Connection->execute()
#2 /wwwroot/xunruiCMS/dayrui/System/Database/BaseConnection.php(625): CodeIgniter\Database\BaseConnection->simpleQuery()
#3 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(2143): CodeIgniter\Database\BaseConnection->query()
#4 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(1047): Phpcmf\View->_query()
#5 /wwwroot/xunruiCMS/cache/template/template_pc_newmoban_home_schoolnews_show-weizhi.html.cache.php(38): Phpcmf\View->list_tag()
#6 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(222): include('/wwwroot/xunrui...')
#7 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(437): Phpcmf\View->display()
#8 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(684): Phpcmf\Home\Module->_Show()
#9 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(912): Phpcmf\Home\Module->_Create_Show_Html()
#10 /wwwroot/xunruiCMS/dayrui/App/Schoolnews/Controllers/Html.php(22): Phpcmf\Home\Module->_Show_Html()
#11 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(931): Phpcmf\Controllers\Html->show()
#12 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(427): CodeIgniter\CodeIgniter->runController()
#13 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest()
#14 /wwwroot/xunruiCMS/dayrui/Fcms/Init.php(398): CodeIgniter\CodeIgniter->run()
#15 /wwwroot/xunruiCMS/index.php(50): require('/wwwroot/xunrui...')
#16 {main}

我测试

{sql sql='select * from @#1_school where id=1'} 就没有问题  内容什么的  都能出来
然后我测试 {sql sql='select * from @#1_school where id={~$t.diaoqu1~}'}   没有报错  但是没有内容  不知道值哪里出错了


回帖
  • 迅睿框架技术-景攸
    #1楼    迅睿框架技术-景攸
    2021-02-03 10:40:27
    Chrome 0
    语法错了
    {php $query=urlencode('select * from @#1_school where id='.$t.diaoqu1);}
    {sql sql='$query'} 
    <div class="ycasedet_info" id="dianhua">
    参考文档:《SQL语句循环》
  • 晓猛seo
    #2楼    晓猛seo
    2021-02-03 10:57:27
    Chrome 0
    迅睿框架技术-景攸 我根据你改的
    {php $query=urlencode('select * from @#1_school where id='.$t.diaoqu1);}
                                {sql sql='$query'}
                                <div class="ycasedet_info" id="dianhua">
                                <p>答:{$t.dianqu1}位于{$t.dizhi}位置,下面是小编个人整理的位置地图,希望可以帮助到您</p><p><img src="{dr_get_file($t.weizhitupian)}" alt="{$t.title}位置图" /></p>
                                </div>
                                {/sql}
    还是报错
    ERROR - 2021-02-03 10:50:08 --> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1#SQL:select * from dr_1_school where id=#URL:http://wz.entem.cn/index.php?s=schoolnews&c=html&m=show&catids=2&pp=1#AGENT:Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36#REFERER:http://wz.entem.cn/admin.php?c=html&m=show_index&app=schoolnews&pagesize=10&id_form=&id_to=&date_form=&date_to=&catids%5B%5D=2#0 /wwwroot/xunruiCMS/dayrui/System/Database/MySQLi/Connection.php(314): mysqli->query()#1 /wwwroot/xunruiCMS/dayrui/System/Database/BaseConnection.php(697): CodeIgniter\Database\MySQLi\Connection->execute()#2 /wwwroot/xunruiCMS/dayrui/System/Database/BaseConnection.php(625): CodeIgniter\Database\BaseConnection->simpleQuery()#3 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(2143): CodeIgniter\Database\BaseConnection->query()#4 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(1047): Phpcmf\View->_query()#5 /wwwroot/xunruiCMS/cache/template/template_pc_newmoban_home_schoolnews_show-weizhi.html.cache.php(40): Phpcmf\View->list_tag()#6 /wwwroot/xunruiCMS/dayrui/Fcms/Core/View.php(222): include('/wwwroot/xunrui...')#7 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(437): Phpcmf\View->display()#8 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(684): Phpcmf\Home\Module->_Show()#9 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(912): Phpcmf\Home\Module->_Create_Show_Html()#10 /wwwroot/xunruiCMS/dayrui/App/Schoolnews/Controllers/Html.php(22): Phpcmf\Home\Module->_Show_Html()#11 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(931): Phpcmf\Controllers\Html->show()#12 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(427): CodeIgniter\CodeIgniter->runController()#13 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest()#14 /wwwroot/xunruiCMS/dayrui/Fcms/Init.php(398): CodeIgniter\CodeIgniter->run()#15 /wwwroot/xunruiCMS/index.php(50): require('/wwwroot/xunrui...')#16 {main}
  • 迅睿框架技术-景攸
    #3楼    迅睿框架技术-景攸
    2021-02-03 10:58:27
    Chrome 0
    $t.diaoqu1
    这个变量是从哪里来的?你在错误提示的是空值,变量不存在
  • 易学习
    #4楼    易学习
    2021-02-03 11:03:14
    Chrome 0


    逻辑问题,变量1都不存在,变量2才开始定义的,变量1完全就是空白值
  • 晓猛seo
    #5楼    晓猛seo
    2021-02-03 11:07:52
    Chrome 0
    迅睿框架技术-景攸
    {php $query=urlencode('select * from @#1_school where id='.$t.iddiaoqu);}
                                {sql sql='$query'}
                                <div class="ycasedet_info" id="dianhua">
                                <p>答:{$t.dianqu1}位于{$t.dizhi}位置,下面是小编个人整理的位置地图,希望可以帮助到您</p><p><img src="{dr_get_file($t.weizhitupian)}" alt="{$t.title}位置图" /></p>
                                </div>
                                {/sql}
    依然报错CRITICAL - 2021-02-03 11:04:52 --> syntax error, unexpected 'iddiaoqu' (T_STRING), expecting ')'#SQL:SELECT * FROM `dr_1_schoolnews` WHERE `catid` = 2 AND `status` = 9 AND `id` > 36 ORDER BY `id` asc LIMIT 1#URL:http://wz.entem.cn/index.php?s=schoolnews&c=html&m=show&catids=2&pp=1#AGENT:Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36#REFERER:http://wz.entem.cn/admin.php?c=html&m=show_index&app=schoolnews&pagesize=10&id_form=&id_to=&date_form=&date_to=&catids%5B%5D=2#0 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(437): Phpcmf\View->display()#1 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(684): Phpcmf\Home\Module->_Show()#2 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(912): Phpcmf\Home\Module->_Create_Show_Html()#3 /wwwroot/xunruiCMS/dayrui/App/Schoolnews/Controllers/Html.php(22): Phpcmf\Home\Module->_Show_Html()#4 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(931): Phpcmf\Controllers\Html->show()#5 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(427): CodeIgniter\CodeIgniter->runController()#6 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest()#7 /wwwroot/xunruiCMS/dayrui/Fcms/Init.php(398): CodeIgniter\CodeIgniter->run()#8 /wwwroot/xunruiCMS/index.php(50): require('/wwwroot/xunrui...')#9 {main}
  • 迅睿框架技术-景攸
    #6楼    迅睿框架技术-景攸
    2021-02-03 11:12:11
    Chrome 0
    五楼所说的非常对,你逻辑是错误的
    $t.diaoqu1

    这个变量是从哪里来的?你在错误提示的是空值,变量不存在

    -------这个问题你没有正面回答我晓猛seo

  • 晓猛seo
    #7楼    晓猛seo
    2021-02-03 11:16:15
    Chrome 0
    易学习
    {php $query=urlencode('select * from @#1_school where id='.$t.iddiaoqu);}
    iddiaoqu 这个字段里面是数字,diaoqu1 、diaoqu2 这两个字段的内容是 汉字 和字母 我现在报错这个
    CRITICAL - 2021-02-03 11:04:52 --> syntax error, unexpected 'iddiaoqu' (T_STRING), expecting ')'
    #SQL:SELECT * FROM `dr_1_schoolnews` WHERE `catid` = 2 AND `status` = 9 AND `id` > 36 ORDER BY `id` asc  LIMIT 1
    #URL:http://wz.entem.cn/index.php?s=schoolnews&c=html&m=show&catids=2&pp=1
    #AGENT:Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
    #REFERER:http://wz.entem.cn/admin.php?c=html&m=show_index&app=schoolnews&pagesize=10&id_form=&id_to=&date_form=&date_to=&catids%5B%5D=2
    #0 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(437): Phpcmf\View->display()
    #1 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(684): Phpcmf\Home\Module->_Show()
    #2 /wwwroot/xunruiCMS/dayrui/Fcms/Control/Home/Module.php(912): Phpcmf\Home\Module->_Create_Show_Html()
    #3 /wwwroot/xunruiCMS/dayrui/App/Schoolnews/Controllers/Html.php(22): Phpcmf\Home\Module->_Show_Html()
    #4 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(931): Phpcmf\Controllers\Html->show()
    #5 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(427): CodeIgniter\CodeIgniter->runController()
    #6 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest()
    #7 /wwwroot/xunruiCMS/dayrui/Fcms/Init.php(398): CodeIgniter\CodeIgniter->run()
    #8 /wwwroot/xunruiCMS/index.php(50): require('/wwwroot/xunrui...')
    #9 {main}


    这个是我设置的字段
  • 晓猛seo
    #8楼    晓猛seo
    2021-02-03 11:17:14
    Chrome 0
    迅睿框架技术-景攸

  • 迅睿框架技术-景攸
    #9楼    迅睿框架技术-景攸
    2021-02-03 11:20:38
    Chrome 0
    这个问题你没有正面回答我啊---我换一个问法---------
    {php $query=urlencode('select * from @#1_school where id='.$t.iddiaoqu);}
    其中
    $t.iddiaoqu
    是读取的哪里数据,或者是内容页showl.lhtml当前的
    iddiaoqu
    字段吗??
  • 晓猛seo
    #10楼    晓猛seo
    2021-02-03 11:30:04
    Chrome 0
    迅睿框架技术-景攸 $t.iddiaoqu 字段是 @#_schoolnews 表里面的字段
    {php $query=urlencode('select * from @#1_school where id='.$t.iddiaoqu);}
                                {sql sql='$query'}
                                <div class="ycasedet_info" id="dianhua">
                                <p>答:{$t.dianqu1}位于{$t.dizhi}位置,下面是小编个人整理的位置地图,希望可以帮助到您</p><p><img src="{dr_get_file($t.weizhitupian)}" alt="{$t.title}位置图" /></p>
                                </div>
                                {/sql}
    {$t.dianqu1}  和  {$t.dizhi}   是在@#_school 这个表里面
  • 迅睿框架技术-景攸
    #11楼    迅睿框架技术-景攸
    2021-02-03 11:34:08
    Chrome 0
    哎,算了,我无能为力了,一点儿都不配合,任然没有正面回答我的问题,根本不知道这个参数从哪里获取的,不然他永远是空白的,你只能写死值
  • 易学习
    #12楼    易学习
    2021-02-03 11:37:16
    Chrome 0
    他逻辑有问题,楼主可以私聊QQ我,数据调用我还是比较在行的
  • 晓猛seo
    #13楼    晓猛seo
    2021-02-03 11:38:17
    Chrome 0
    迅睿框架技术-景攸 对不起呀 朋友 原谅我是一个小白 您刚才说的 $t.iddiaoqu 字段是从 @#1_schoolnews 数据表里面获取的 不知道是您想要大结果不
  • 晓猛seo
    #14楼    晓猛seo
    2021-02-03 11:53:28
    Chrome 0
    易学习 我私聊您了
    满意答案
  • 晓猛seo
    #15楼    晓猛seo
    2021-02-03 12:15:40
    Chrome 0
    增加悬赏(设置悬赏)金:10元,希望大家给予帮助!
  • 晓猛seo
    #16楼    晓猛seo
    2021-02-03 16:47:33
    Chrome 0
    @晓猛seo:已经解决了 是语法的问题