PHP JOIN LEFT WHERE不会工作。我做错了什么?

时间:2016-09-13 13:38:47

标签: php join

  <div ng-controller="EventSimpleCtrl" class="ng-scope">
<div class="container"></div>
<div class="row">
  <div class="col-md-12">
    <!--<div class="panel panel-primary map">-->
    <!--  <div class="panel-heading">Test</div>-->
    <!--  <div class="panel-body">-->
    <!--    <map zoom="4" center="-25.363882, 131.044922" on-center-changed="centerChanged()">-->
    <!--      <marker position="-25.363882, 131.044922" on-click="click()" title="Click to zoom"></marker>-->
    <!--    </map>-->
    <!--  </div>-->
    <!--</div>-->
    <map zoom="4" center="-25.363882, 131.044922" on-center-changed="centerChanged()">
      <marker position="-25.363882, 131.044922" on-click="click()" title="Click to zoom"></marker>
    </map>
          </div>
  </div>
  </div>

大家好。我的代码的最后一部分有什么问题。

 $sql= "SELECT name, content FROM {$dbpraefix}meta_global 
           UNION SELECT name, content FROM {$dbpraefix}meta_local 
           LEFT JOIN {$dbpraefix}pages ON {$dbpraefix}pages.id={$dbpraefix}meta_local.page 
           WHERE {$dbpraefix}pages.alias = $_GET['include']";

我的页面无效。但是,如果我抛弃最后一部分,它运作良好。 这是我的一部分&#34;建立自己的CMS&#34; PROJEKT。 谢谢你的回答。

1 个答案:

答案 0 :(得分:0)

试试这个:添加单引号

$sql= "SELECT name, content FROM {$dbpraefix}meta_global 
           UNION SELECT name, content FROM {$dbpraefix}meta_local 
           LEFT JOIN {$dbpraefix}pages ON {$dbpraefix}pages.id={$dbpraefix}meta_local.page 
           WHERE {$dbpraefix}pages.alias = '".$_GET['include']."'";