所以起初我为用户在其工作的数据库中输入数据制定了一个公式,之后我试图让他们能够修改数据。 我有这个错误和其他几个
解析错误:语法错误,意外'}'在 第131行的C:\ xampp \ htdocs \ Atestat \ addate.php
问题出现在else语句(131)
上<?php
include 'ch20_include.php';
doDB();
if (!$_POST) {
//haven’t seen the form, so show it
$display_block = <<<END_OF_TEXT
<form method=”post” action=”$_SERVER[PHP_SELF]”>
<fieldset>
<legend>First/Last Names:</legend><br/>
<input type=”text” name=”f_name” size=”30”
maxlength=”75” required=”required” />
<input type=”text” name=”l_name” size=”30”
maxlength=”75” required=”required” />
</fieldset>
<p><label for="adress">Strada:</label><br/>
<input type="text" id="adress" name="adress" size="30" /></p>
<fieldset>
<legend>Oras/Judet/Cod Postal:</legend><br/>
<input type="text" name="oras" size="30" maxlength="50" />
<input type="text" name="judet" size="5" maxlength="2" />
<input type="text" name="cod_postal" size="10" maxlength="10" />
</fieldset>
<fieldset>
<legend>Numar de Telefon:</legend><br/>
<input type="text" name="telefon" size="30" maxlength="25" />
<input type="radio" id="tel_type_h" name="tel_type" value="home" checked />
<label for="tel_type_h">Acasa</label>
<input type="radio" id="tel_type_w" name="tel_type" value="work" />
<label for="tel_type_w">Elev</label>
<input type="radio" id="tel_type_o" name="tel_type" value="altceva" />
<label for="tel_type_o">Altceva</label>
</fieldset>
<fieldset>
<legend>Nota-Romana:</legend><br/>
<input type="text" name="notar_1" size="5" maxlength="50" />
<input type="text" name="notar_2" size="5" maxlength="50" />
<input type="text" name="notar_3" size="5" maxlength="50" />
<input type="text" name="notar_4" size="5" maxlength="50" />
<input type="text" name="notar_5" size="5" maxlength="50" />
<input type="text" name="medier" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Biologie:</legend><br/>
<input type="text" name="notab_1" size="5" maxlength="50" />
<input type="text" name="notab_2" size="5" maxlength="50" />
<input type="text" name="notab_3" size="5" maxlength="50" />
<input type="text" name="notab_4" size="5" maxlength="50" />
<input type="text" name="notab_5" size="5" maxlength="50" />
<input type="text" name="medieb" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Chimie:</legend><br/>
<input type="text" name="notac_1" size="5" maxlength="50" />
<input type="text" name="notac_2" size="5" maxlength="50" />
<input type="text" name="notac_3" size="5" maxlength="50" />
<input type="text" name="notac_4" size="5" maxlength="50" />
<input type="text" name="notac_5" size="5" maxlength="50" />
<input type="text" name="mediec" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Fizica:</legend><br/>
<input type="text" name="notaf_1" size="5" maxlength="50" />
<input type="text" name="notaf_2" size="5" maxlength="50" />
<input type="text" name="notaf_3" size="5" maxlength="50" />
<input type="text" name="notaf_4" size="5" maxlength="50" />
<input type="text" name="notaf_5" size="5" maxlength="50" />
<input type="text" name="medief" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Franceza:</legend><br/>
<input type="text" name="notafr_1" size="5" maxlength="50" />
<input type="text" name="notafr_2" size="5" maxlength="50" />
<input type="text" name="notafr_3" size="5" maxlength="50" />
<input type="text" name="notafr_4" size="5" maxlength="50" />
<input type="text" name="notafr_5" size="5" maxlength="50" />
<input type="text" name="mediefr" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Germana:</legend><br/>
<input type="text" name="notag_1" size="5" maxlength="50" />
<input type="text" name="notag_2" size="5" maxlength="50" />
<input type="text" name="notag_3" size="5" maxlength="50" />
<input type="text" name="notag_4" size="5" maxlength="50" />
<input type="text" name="notag_5" size="5" maxlength="50" />
<input type="text" name="medieg" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Informatica:</legend><br/>
<input type="text" name="notai_1" size="5" maxlength="50" />
<input type="text" name="notai_2" size="5" maxlength="50" />
<input type="text" name="notai_3" size="5" maxlength="50" />
<input type="text" name="notai_4" size="5" maxlength="50" />
<input type="text" name="notai_5" size="5" maxlength="50" />
<input type="text" name="mediei" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Matematica:</legend><br/>
<input type="text" name="notam_1" size="5" maxlength="50" />
<input type="text" name="notam_2" size="5" maxlength="50" />
<input type="text" name="notam_3" size="5" maxlength="50" />
<input type="text" name="notam_4" size="5" maxlength="50" />
<input type="text" name="notam_5" size="5" maxlength="50" />
<input type="text" name="mediem" size="5" maxlength="50" />
</fieldset>
<fieldset>
<legend>Nota-Religie:</legend><br/>
<input type="text" name="notare_1" size="5" maxlength="50" />
<input type="text" name="notare_2" size="5" maxlength="50" />
<input type="text" name="notare_3" size="5" maxlength="50" />
<input type="text" name="notare_4" size="5" maxlength="50" />
<input type="text" name="notare_5" size="5" maxlength="50" />
<input type="text" name="mediere" size="5" maxlength="50" />
</fieldset>
<p><label for="nota_personala">Nota Personala:</label><br/>
<textarea id="nota_personala" name="note" cols="35" rows="3"></textarea></p>
END_OF_TEXT;
if ($_GET) {
$display_block .= "<input type=\"hidden\" name=\"nume_id\"
value=\"".$_GET[‘nume_id’]."\">";
}
$display_block .= <<<END_OF_TEXT
<button type="submit" name="Submit" value="Send">Adauga Elev</button>
</form>
END_OF_TEXT;
} } else if ($_POST) {
if ((($_POST['p_nume'] == "") || ($_POST['nume'] == "")) &&
(!isset($_POST['nume_id']))) {
header("Location: addate.php");
exit;
}
//Conectarea la bazadedate
doDB();
$safe_p_nume = mysqli_real_escape_string($mysqli,$_POST['p_nume']);
$safe_nume = mysqli_real_escape_string($mysqli,$_POST['nume']);
$safe_adresa = mysqli_real_escape_string($mysqli,$_POST['adress']);
$safe_oras = mysqli_real_escape_string($mysqli,$_POST['oras']);
$safe_judet = mysqli_real_escape_string($mysqli,$_POST['judet']);
$safe_cod_postal = mysqli_real_escape_string($mysqli,$_POST['cod_postal']);
$safe_tel_numar = mysqli_real_escape_string($mysqli, $_POST['telefon']);
$safe_notab_1 = mysqli_real_escape_string($mysqli,$_POST['notab_1']);
$safe_notab_2 = mysqli_real_escape_string($mysqli,$_POST['notab_2']);
$safe_notab_3 = mysqli_real_escape_string($mysqli,$_POST['notab_3']);
$safe_notab_4 = mysqli_real_escape_string($mysqli,$_POST['notab_4']);
$safe_notab_5 = mysqli_real_escape_string($mysqli,$_POST['notab_5']);
$safe_medieb = mysqli_real_escape_string($mysqli,$_POST['medieb']);
$safe_notac_1 = mysqli_real_escape_string($mysqli,$_POST['notac_1']);
$safe_notac_2 = mysqli_real_escape_string($mysqli,$_POST['notac_2']);
$safe_notac_3 = mysqli_real_escape_string($mysqli,$_POST['notac_3']);
$safe_notac_4 = mysqli_real_escape_string($mysqli,$_POST['notac_4']);
$safe_notac_5 = mysqli_real_escape_string($mysqli,$_POST['notac_5']);
$safe_mediec = mysqli_real_escape_string($mysqli,$_POST['mediec']);
$safe_notaf_1 = mysqli_real_escape_string($mysqli,$_POST['notaf_1']);
$safe_notaf_2 = mysqli_real_escape_string($mysqli,$_POST['notaf_2']);
$safe_notaf_3 = mysqli_real_escape_string($mysqli,$_POST['notaf_3']);
$safe_notaf_4 = mysqli_real_escape_string($mysqli,$_POST['notaf_4']);
$safe_notaf_5 = mysqli_real_escape_string($mysqli,$_POST['notaf_5']);
$safe_medief = mysqli_real_escape_string($mysqli,$_POST['medief']);
$safe_notafr_1 = mysqli_real_escape_string($mysqli,$_POST['notafr_1']);
$safe_notafr_2 = mysqli_real_escape_string($mysqli,$_POST['notafr_2']);
$safe_notafr_3 = mysqli_real_escape_string($mysqli,$_POST['notafr_3']);
$safe_notafr_4 = mysqli_real_escape_string($mysqli,$_POST['notafr_4']);
$safe_notafr_5 = mysqli_real_escape_string($mysqli,$_POST['notafr_5']);
$safe_mediefr = mysqli_real_escape_string($mysqli,$_POST['mediefr']);
$safe_notag_1 = mysqli_real_escape_string($mysqli,$_POST['notag_1']);
$safe_notag_2 = mysqli_real_escape_string($mysqli,$_POST['notag_2']);
$safe_notag_3 = mysqli_real_escape_string($mysqli,$_POST['notag_3']);
$safe_notag_4 = mysqli_real_escape_string($mysqli,$_POST['notag_4']);
$safe_notag_5 = mysqli_real_escape_string($mysqli,$_POST['notag_5']);
$safe_medieg = mysqli_real_escape_string($mysqli,$_POST['medieg']);
$safe_notai_1 = mysqli_real_escape_string($mysqli,$_POST['notai_1']);
$safe_notai_2 = mysqli_real_escape_string($mysqli,$_POST['notai_2']);
$safe_notai_3 = mysqli_real_escape_string($mysqli,$_POST['notai_3']);
$safe_notai_4 = mysqli_real_escape_string($mysqli,$_POST['notai_4']);
$safe_notai_5 = mysqli_real_escape_string($mysqli,$_POST['notai_5']);
$safe_mediei = mysqli_real_escape_string($mysqli,$_POST['mediei']);
$safe_notam_1 = mysqli_real_escape_string($mysqli,$_POST['notam_1']);
$safe_notam_2 = mysqli_real_escape_string($mysqli,$_POST['notam_2']);
$safe_notam_3 = mysqli_real_escape_string($mysqli,$_POST['notam_3']);
$safe_notam_4 = mysqli_real_escape_string($mysqli,$_POST['notam_4']);
$safe_notam_5 = mysqli_real_escape_string($mysqli,$_POST['notam_5']);
$safe_mediem = mysqli_real_escape_string($mysqli,$_POST['mediem']);
$safe_notare_1 = mysqli_real_escape_string($mysqli,$_POST['notare_1']);
$safe_notare_2 = mysqli_real_escape_string($mysqli,$_POST['notare_2']);
$safe_notare_3 = mysqli_real_escape_string($mysqli,$_POST['notare_3']);
$safe_notare_4 = mysqli_real_escape_string($mysqli,$_POST['notare_4']);
$safe_notare_5 = mysqli_real_escape_string($mysqli,$_POST['notare_5']);
$safe_mediere = mysqli_real_escape_string($mysqli,$_POST['mediere']);
$safe_notar_1 = mysqli_real_escape_string($mysqli,$_POST['notar_1']);
$safe_notar_2 = mysqli_real_escape_string($mysqli,$_POST['notar_2']);
$safe_notar_3 = mysqli_real_escape_string($mysqli,$_POST['notar_3']);
$safe_notar_4 = mysqli_real_escape_string($mysqli,$_POST['notar_4']);
$safe_notar_5 = mysqli_real_escape_string($mysqli,$_POST['notar_5']);
$safe_medier = mysqli_real_escape_string($mysqli,$_POST['medier']);
$safe_note = mysqli_real_escape_string($mysqli,$_POST['note']);
//Adauga
if (!$_POST['nume_id']) {
$add_nume_sql = "INSERT INTO nume_principal (date_added, date_modified,
p_name, nume) VALUES (now(), now(), '".$safe_p_nume."', '".$safe_nume."')";
$add_nume_res = mysqli_query($mysqli, $add_nume_sql) or die(mysqli_error($mysqli));
$nume_id = mysqli_insert_id($mysqli);
} else {
$nume_id = mysqli_real_escape_string($mysqli, $_POST['nume_id']);
}
if (($_POST['adress']) || ($_POST['oras']) || ($_POST['judet']) || ($_POST['cod_postal'])) {
$add_adress_sql = "INSERT INTO adress (nume_id,date_added,date_modified,adresa,oras,judet,cod_postal) VALUES ('".$nume_id."',now(),now(),'".$safe_adresa."','".$safe_oras."','".$safe_judet."','".$safe_cod_postal."')";
$add_adress_res = mysqli_query($mysqli, $add_adress_sql) or die(mysqli_error($mysqli));
}
if ($_POST['telefon']) {
$add_tel_sql = "INSERT INTO telefon (nume_id, date_added, date_modified, tel_numar) VALUES ('".$nume_id."', now(), now(), '".$safe_tel_numar."')";
$add_tel_res = mysqli_query($mysqli, $add_tel_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notab_1']) || ($_POST['notab_2']) || ($_POST['notab_3']) || ($_POST['notab_4']) || ($_POST['notab_5']) || ($_POST['medieb'])) {
$add_biologie_sql = "INSERT INTO biologie (nume_id,date_added,date_modified,notab_1,notab_2,notab_3,notab_4,notab_5,medieb) VALUES ('".$nume_id."',now(),now(),'".$safe_notab_1."','".$safe_notab_2."','".$safe_notab_3."','".$safe_notab_4."','".$safe_notab_5."','".$safe_medieb."')";
$add_biologie_res = mysqli_query($mysqli,$add_biologie_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notac_1']) || ($_POST['notac_2']) || ($_POST['notac_3']) || ($_POST['notac_4']) || ($_POST['notac_5']) || ($_POST['mediec'])) {
$add_chimie_sql = "INSERT INTO chimie (nume_id, date_added, date_modified, notac_1, notac_2, notac_3, notac_4, notac_5, mediec) VALUES ('".$nume_id."', now(), now(), '".$safe_notac_1."' ,'".$safe_notac_2."', '".$safe_notac_3."', '".$safe_notac_4."', '".$safe_notac_5."', '".$safe_mediec."')";
$add_chimie_res = mysqli_query($mysqli,$add_chimie_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notaf_1']) || ($_POST['notaf_2']) || ($_POST['notaf_3']) || ($_POST['notaf_4']) || ($_POST['notaf_5']) || ($_POST['medief'])) {
$add_fizica_sql = "INSERT INTO fizica(nume_id, date_added, date_modified, notaf_1, notaf_2, notaf_3, notaf_4, notaf_5, medief) VALUES ('".$nume_id."', now(), now(), '".$safe_notaf_1."' ,'".$safe_notaf_2."', '".$safe_notaf_3."', '".$safe_notaf_4."', '".$safe_notaf_5."', '".$safe_medief."')";
$add_fizica_res = mysqli_query($mysqli,$add_fizica_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notafr_1']) || ($_POST['notafr_2']) || ($_POST['notafr_3']) || ($_POST['notafr_4']) || ($_POST['notafr_5']) || ($_POST['mediefr'])) {
$add_franceza_sql = "INSERT INTO franceza (nume_id, date_added, date_modified, notafr_1, notafr_2, notafr_3, notafr_4, notafr_5, mediefr) VALUES ('".$nume_id."', now(), now(), '".$safe_notafr_1."' ,'".$safe_notafr_2."', '".$safe_notafr_3."', '".$safe_notafr_4."', '".$safe_notafr_5."', '".$safe_mediefr."')";
$add_franceza_res = mysqli_query($mysqli,$add_franceza_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notag_1']) || ($_POST['notag_2']) || ($_POST['notag_3']) || ($_POST['notag_4']) || ($_POST['notag_5']) || ($_POST['medieg'])) {
$add_germana_sql = "INSERT INTO germana (nume_id, date_added, date_modified, notag_1, notag_2, notag_3, notag_4, notag_5, medieg) VALUES ('".$nume_id."', now(), now(), '".$safe_notag_1."' ,'".$safe_notag_2."', '".$safe_notag_3."', '".$safe_notag_4."', '".$safe_notag_5."', '".$safe_medieg."')";
$add_germana_res = mysqli_query($mysqli,$add_germana_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notai_1']) || ($_POST['notai_2']) || ($_POST['notai_3']) || ($_POST['notai_4']) || ($_POST['notai_5']) || ($_POST['mediei'])) {
$add_informatica_sql = "INSERT INTO informatica (nume_id, date_added, date_modified, notai_1, notai_2, notai_3, notai_4, notai_5, mediei) VALUES ('".$nume_id."', now(), now(), '".$safe_notai_1."' ,'".$safe_notai_2."', '".$safe_notai_3."', '".$safe_notai_4."', '".$safe_notai_5."', '".$safe_mediei."')";
$add_informatica_res = mysqli_query($mysqli,$add_informatica_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notam_1']) || ($_POST['notam_2']) || ($_POST['notam_3']) || ($_POST['notam_4']) || ($_POST['notam_5']) || ($_POST['mediem'])) {
$add_matematica_sql = "INSERT INTO matematica (nume_id, date_added, date_modified, notam_1, notam_2, notam_3, notam_4, notam_5, mediem) VALUES ('".$nume_id."', now(), now(), '".$safe_notam_1."' ,'".$safe_notam_2."', '".$safe_notam_3."', '".$safe_notam_4."', '".$safe_notam_5."', '".$safe_mediem."')";
$add_matematica_res = mysqli_query($mysqli,$add_matematica_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notare_1']) || ($_POST['notare_2']) || ($_POST['notare_3']) || ($_POST['notare_4']) || ($_POST['notare_5']) || ($_POST['mediere'])) {
$add_religie_sql = "INSERT INTO religie (nume_id, date_added, date_modified, notare_1, notare_2, notare_3, notare_4, notare_5, mediere) VALUES ('".$nume_id."', now(), now(), '".$safe_notare_1."' ,'".$safe_notare_2."', '".$safe_notare_3."', '".$safe_notare_4."', '".$safe_notare_5."', '".$safe_mediere."')";
$add_religie_res = mysqli_query($mysqli,$add_religie_sql) or die(mysqli_error($mysqli));
}
if (($_POST['notar_1']) || ($_POST['notar_2']) || ($_POST['notar_3']) || ($_POST['notar_4']) || ($_POST['notar_5']) || ($_POST['medier'])) {
$add_romana_sql = "INSERT INTO romana (nume_id, date_added, date_modified, notar_1, notar_2, notar_3, notar_4, notar_5, medier) VALUES ('".$nume_id."', now(), now(), '".$safe_notar_1."' ,'".$safe_notar_2."', '".$safe_notar_3."', '".$safe_notar_4."', '".$safe_notar_5."', '".$safe_medier."')";
$add_romana_res = mysqli_query($mysqli,$add_romana_sql) or die(mysqli_error($mysqli));
}
if ($_POST['note']) {
$add_nota_sql = "UPDATE INTO nota_personala (nume_id, date_added, date_modified, note) VALUES ('".$nume_id."', now(), now(), '".$safe_note."')";
$add_nota_res = mysqli_query($mysqli, $add_nota_sql) or die(mysql_error($mysqli));
}
mysqli_close($mysqli);
$display_block = "<p>A fost adaugat.Ai dori sa mai adaugi si <a href=\"addate.php\">Altceva</a>?</p>";
}
?>
<!DOCTYPE html>
<head>
<title>Adauga un Elev</title>
</head>
<body>
<h1>Adauga un Elev</h1>
<?php echo $display_block; ?>
</body>
</html>
131行是
} } else if ($_POST) {
if ((($_POST['p_nume'] == "") || ($_POST['nume'] == "")) &&
(!isset($_POST['nume_id']))) {
header("Location: addate.php");
exit;
}
//Conectarea la bazadedate
答案 0 :(得分:0)
} } else if ($_POST) {
应该是
} else if ($_POST) {