我试图调试我的网站错误我遇到了这个问题:
SyntaxError:意外的标识符' oeuvre'。预计要么关闭']'或者','跟随数组元素。
这是代码的一部分:
<?php
$id_site = $_GET['id_site'];
include("include/heritage.php");
$num_vague = $_GET['num_vague'];
$req = $bdd->query("SELECT * FROM site where id_site = $_GET[id_site]");
while ($donnees = $req->fetch())
{
$id_site = $donnees['id_site'];
$id_client_site = $donnees['id_client_site'];
$id_restaurateur_site = $donnees['id_restaurateur_site'];
$nom_site = $donnees['nom_site'];
$nom_site = str_replace("\"", "'", $nom_site);
$cp_site = $donnees['cp_site'];
$ville_site = $donnees['ville_site'];
$adresse_site = $donnees['adresse_site'];
$i2c_site = $donnees['i2c_site'];
}
这是包含的文件heritage.php
:
<?php
$id_site = $_GET['id_site'];
$req_client = $bdd->query("SELECT nom_client FROM membre WHERE id_membre=" . $_SESSION['id_membre_login']);
$donnees_client = $req_client->fetch();
$client_name = $donnees_client['nom_client'];
if ($client_name != '') {
$client_name = addslashes($client_name);
$req_client = $bdd->query("SELECT * FROM client WHERE societe_client = '$client_name'");
$donnees_client = $req_client->fetch();
$passage_1_client = $donnees_client['passage_1_client'];
$passage_2_client = $donnees_client['passage_2_client'];
$couleur1 = $donnees_client['couleur1'];
$couleur2 = $donnees_client['couleur2'];
$couleur3 = $donnees_client['couleur3'];
}
if (isset($_GET['id_site'])) {
$reqClientPassage = $bdd->query("
SELECT client.passage_1_client, client.passage_2_client
FROM site
INNER JOIN client ON client.id_client = site.id_client_site
WHERE id_site =" . $id_site
);
$donneesClientPassage = $reqClientPassage->fetch();
$passage_1_client = $donneesClientPassage['passage_1_client'];
$passage_2_client = $donneesClientPassage['passage_2_client'];
}
?>
感谢您的帮助!
答案 0 :(得分:1)
尝试如下
$req = $bdd->query("SELECT * FROM site where id_site =". $_GET['id_site']); //single quote missing
答案 1 :(得分:1)
更改以下行
$req = $bdd->query("SELECT * FROM site where id_site = $_GET[id_site]");
到
$id = $_GET['id_site'];
$req = $bdd->query("SELECT * FROM site where id_site = $id");
您的语法不正确
答案 2 :(得分:1)
从以下查询中删除$_GET[id_site]
并添加此$id_site
变量
$req = $bdd->query("SELECT * FROM site where id_site = $_GET[id_site]");
到
$req = $bdd->query("SELECT * FROM site where id_site = $id_site");