php - Update-ing in to the Database -
this question has answer here:
- php parse/syntax errors; , how solve them? 12 answers
so @ first made formular users enter data in database worked,after have tried make option them able modify data. , have error , several more
parse error: syntax error, unexpected '}' in c:\xampp\htdocs\atestat\addate.php on line 131
problem somewhere on else statement(131)
<?php include 'ch20_include.php'; dodb(); if (!$_post) { //haven’t seen form, show $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 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 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 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 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 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 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 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 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 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 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 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 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 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>
line 131
} } else if ($_post) { if ((($_post['p_nume'] == "") || ($_post['nume'] == "")) && (!isset($_post['nume_id']))) { header("location: addate.php"); exit; } //conectarea la bazadedate
} } else if ($_post) {
should
} else if ($_post) {
Comments
Post a Comment