Hallo liebe Retrotown Community ich habe versucht mit ein Copy and Paste Script auf meine Bedürfnisse umzubauen, da ich in PHP ein kompletter vollidiot bin und einfach null durchblick habe komme ich auch nach Stunden googeln nicht weiter.
Ich bekomme den Error: "Parse error: syntax error, unexpected '$versicherungsnummer' (T_VARIABLE) in /var/customers/webs/ni84772_3/patadmin/insert.php on line 103" angezeigt.
Da ich mit meinen nerven am Ende bin dachte ich, das ich mal hier bei den Profis nachfrage. Als Belohnung für denjenigen der den Fehler bereinigt würde ich 20€ PayPal Guthaben anbieten.
Formular HTML
<form action="insert.php" method="post">
<input type="number" name="id" placeholder="Id" value="<?php echo $id;?>"><br><br>
<input type="text" name="fname" placeholder="First Name" value="<?php echo $fname;?>"><br><br>
<input type="text" name="lname" placeholder="Last Name" value="<?php echo $lname;?>"><br><br>
<input type="number" name="age" placeholder="Age" value="<?php echo $age;?>"><br><br>
<input type="text" name="adress" placeholder="Adresse" value="<?php echo $adress;?>"><br><br>
<input type="text" name="sozn" placeholder="Versicherungsnummer" value="<?php echo $versicherungsnummer.;?>"><br><br>
<input type="text" name="soz" placeholder="Versicherung value="<?php echo $versicherung;?>"><br><br>
<input type="text" name="puls" placeholder="Puls" value="<?php echo $puls;?>"><br><br>
<input type="text" name="spo" placeholder="SpO2" value="<?php echo $spo;?>"><br><br>
<input type="text" name="nibp" placeholder="Blutdruck" value="<?php echo $nibp;?>"><br><br>
<input type="text" name="bz" placeholder="Blutzucker" value="<?php echo $bz;?>"><br><br>
<input type="text" name="ekg" placeholder="EKG-Befund" value="<?php echo $ekg;?>"><br><br>
<input type="text" name="temp" placeholder="Temperatur" value="<?php echo $temp;?>"><br><br>
<input type="text" name="gcs" placeholder="Glascow Coma Scale" value="<?php echo $gcs;?>"><br><br>
<input type="text" name="pupillen" placeholder="Pupillen" value="<?php echo $pupillen;?>"><br><br>
<input type="text" name="anamnese" placeholder="Anamnese" value="<?php echo $anamnese;?>"><br><br>
<input type="text" name="befund" placeholder="Befunde" value="<?php echo $befund;?>"><br><br>
<input type="text" name="airway" placeholder="Airway" value="<?php echo $airway;?>"><br><br>
<input type="text" name="breathing" placeholder="Breathing" value="<?php echo $breathing;?>"><br><br>
<input type="text" name="circulation" placeholder="Circulation" value="<?php echo $circulatio;?>"><br><br>
<input type="text" name="disbility" placeholder="Disability" value="<?php echo $disbility;?>"><br><br>
<input type="text" name="exposure" placeholder="Exposure" value="<?php echo $exposure;?>"><br><br>
<input type="text" name="allergien" placeholder="Allergien" value="<?php echo $allergien;?>"><br><br>
<input type="text" name="medikamente" placeholder="Medikamente" value="<?php echo $medikamente;?>"><br><br>
<input type="text" name="pastmedical" placeholder="relevante Krankengeschichte" value="<?php echo $pastmedical;?>"><br><br>
<input type="text" name="letzte" placeholder="Letzte Nahrungsaufnahme & Ausscheidungen" value="<?php echo $letzte;?>"><br><br>
<input type="text" name="ereignisse" placeholder="Ereignisse vor Symptomatik" value="<?php echo $ereignisse;?>"><br><br>
<input type="text" name="risiko" placeholder="Risiken (Nikotin, Alkohol, Schwangerschaft)" value="<?php echo $risiko;?>"><br><br>
<div>
<!-- Input For Add Values To Database-->
<input type="submit" name="insert" value="Add">
<!-- Input For Edit Values -->
<input type="submit" name="update" value="Update">
<!-- Input For Clear Values -->
<input type="submit" name="delete" value="Delete">
<!-- Input For Find Values With The given ID -->
<input type="submit" name="search" value="Find">
</div>
</form>
Alles anzeigen
PHP File
<?php
$host = "localhost";
$user = "ni84772_3sql32";
$password ="1234";
$database = "ni84772_3sql32";
$id = "";
$fname = "";
$lname = "";
$age = "";
$adress = "";
$versicherungsnummer = "";
$versicherung = "";
$puls = "";
$spo = "";
$nibp = "";
$bz = "";
$ekg = "";
$temp = "";
$gcs = "";
$pupillen = "";
$anamnese = "";
$befund = "";
$airway = "";
$breathing = "";
$circulation = "";
$disbility = "";
$exposure = "";
$allergien = "";
$medikamente = "";
$pastmedical = "";
$letzte = "";
$ereignisse = "";
$risiko = "";
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// connect to mysql database
try{
$connect = mysqli_connect($host, $user, $password, $database);
} catch (mysqli_sql_exception $ex) {
echo 'Error';
}
// get values from the form
function getPosts()
{
$posts = array();
$posts[0] = $_POST['id'];
$posts[1] = $_POST['fname'];
$posts[2] = $_POST['lname'];
$posts[3] = $_POST['age'];
$posts[4] = $_POST['adress'];
$posts[5] = $_POST['versicherungsnummer'];
$posts[6] = $_POST['versicherung'];
$posts[7] = $_POST['puls'];
$posts[8] = $_POST['spo'];
$posts[9] = $_POST['nibp'];
$posts[10] = $_POST['bz'];
$posts[11] = $_POST['ekg'];
$posts[12] = $_POST['temp'];
$posts[13] = $_POST['gcs'];
$posts[14] = $_POST['pupillen'];
$posts[15] = $_POST['anamnese'];
$posts[16] = $_POST['befund'];
$posts[17] = $_POST['airway'];
$posts[18] = $_POST['breathing'];
$posts[19] = $_POST['circulation'];
$posts[20] = $_POST['disability'];
$posts[21] = $_POST['exposure'];
$posts[22] = $_POST['allergien'];
$posts[23] = $_POST['medikamente'];
$posts[24] = $_POST['pastmedical'];
$posts[25] = $_POST['letzte'];
$posts[26] = $_POST['ereignisse'];
$posts[27] = $_POST['risiko'];
return $posts;
}
// Search
if(isset($_POST['search']))
{
$data = getPosts();
$search_Query = "SELECT * FROM doku WHERE id = $data[0]";
$search_Result = mysqli_query($connect, $search_Query);
if($search_Result)
{
if(mysqli_num_rows($search_Result))
{
while($row = mysqli_fetch_array($search_Result))
{
$id = $row['id'];
$fname = $row['fname'];
$lname = $row['lname'];
$age = $row['age'];
$adress = $row['adress']
$versicherungsnummer = $row['versicherungsnummer']
$versicherung = $row['versicherung']
$puls = $row['puls']
$spo = $row['spo']
$nibp = $row['nibp']
$bz = $row['bz']
$ekg = $row['ekg']
$temp = $row['temp']
$gcs = $row['gcs']
$pupillen = $row['pupillen']
$anamnese = $row['anamnese']
$befund = $row['befund']
$airway = $row['airway']
$breathing = $row['breathing']
$circulation = $row['circulation']
$disability = $row['disability']
$exposure = $row['exposure']
$allergien = $row['allergien']
$medikamente = $row['medikamente']
$pastmedical = $row['pastmedical']
$letzte = $row['letzte']
$ereignisse = $row['ereignisse']
$risiko = $row['risiko']
}
}else{
echo 'No Data For This Id';
}
}else{
echo 'Result Error';
}
}
// Insert
if(isset($_POST['insert']))
{
$data = getPosts();
$insert_Query = "INSERT INTO `doku`(`fname`, `lname`, `age`, `adress`, `versicherungsnummer`, `versicherung`, `puls`, `spo`, `nibp`, `bz`, `ekg`, `temp`, `gcs`, `pupillen`, `anamnese`, `befund`, `airway`, `breathing`, `circulation`, `disability`, `exposure`, `allergien`, `medikamente`, `pastmedical`, `letzte`, `ereignisse`, `risiko`) VALUES ('$data[1]','$data[2]',$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]','$data[10]','$data[11]','$data[12]','$data[13]','$data[14]','$data[15]','$data[16]','$data[17]','$data[18]','$data[19]','$data[20]','$data[21]','$data[22]','$data[23]','$data[24]','$data[25]','$data[26]','$data[27])";
try{
$insert_Result = mysqli_query($connect, $insert_Query);
if($insert_Result)
{
if(mysqli_affected_rows($connect) > 0)
{
echo 'Data Inserted';
}else{
echo 'Data Not Inserted';
}
}
} catch (Exception $ex) {
echo 'Error Insert '.$ex->getMessage();
}
}
// Delete
if(isset($_POST['delete']))
{
$data = getPosts();
$delete_Query = "DELETE FROM `doku` WHERE `id` = $data[0]";
try{
$delete_Result = mysqli_query($connect, $delete_Query);
if($delete_Result)
{
if(mysqli_affected_rows($connect) > 0)
{
echo 'Data Deleted';
}else{
echo 'Data Not Deleted';
}
}
} catch (Exception $ex) {
echo 'Error Delete '.$ex->getMessage();
}
}
// Edit
if(isset($_POST['update']))
{
$data = getPosts();
$update_Query = "UPDATE `doku` SET `fname`='$data[1]',`lname`='$data[2]',`age`=$data[3],`adress`=$data[4],`versicherungsnummer`=$data[5],`versicherung`=$data[6],`puls`=$data[7],`spo`=$data[8],`nibp`=$data[9],`bz`=$data[10],`ekg`=$data[11],`temp`=$data[12],`gcs`=$data[13],`pupillen`=$data[14],`anamnese`=$data[15],`befund`=$data[16],`airway`=$data[17],`breathing`=$data[18],`circulation`=$data[19],`disability`=$data[20],`exposure`=$data[21],`allergien`=$data[22],`medikamente`=$data[23],`pastmedical`=$data[24],`letzte`=$data[25],`ereignisse`=$data[26],`risiko`=$data[27] WHERE `id` = $data[0]";
try{
$update_Result = mysqli_query($connect, $update_Query);
if($update_Result)
{
if(mysqli_affected_rows($connect) > 0)
{
echo 'Data Updated';
}else{
echo 'Data Not Updated';
}
}
} catch (Exception $ex) {
echo 'Error Update '.$ex->getMessage();
}
}
?>
Alles anzeigen
Ich bin wirklich ein absoluter Noob ich hoffe einer von euch kann mir helfen , das Script ist inkl. Datenbank zum Downloaden das Ihr wenn auch noch mal selber darüberschauen könnt. Ich bedanke mich schon mal sollte sich jemand finden.