0

I use the same Code local and on the server. While its working just fine local, there is no db-entry while running on the server.

While the INSERT statement is not working i can read and update the rows - so the connection should be fine.

Can somebody help me?

function setDataToParticipantTable($db_host, $db_password, $db_user, $db_name, $new_participant)
{
    $db = new PDO('mysql:host=' . $db_host . ';dbname=' . $db_name, $db_user, $db_password);


        $qry = "INSERT INTO " . "`TAEK_Subscriber19`" . " (`Vorname`, `Nachname`, `Email`, `Straße`, `Hausnummer`, `PLZ`, `Ort`, `Land`, `Turnusaerztevertreter`, `DO_VM_WS_1`, `DO_NM_WS_1`, `FR_VM_WS1_1`, `FR_VM_WS2_1`, `FR_NM_WS_1`, `Kongresseroeffnung`, `Kongressparty`, `Infotext`, `Hash`) 
        VALUES 
        (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

        $statement = $db->prepare($qry);

        $statement->bindParam(1, $new_participant['Vorname']);
        $statement->bindParam(2, $new_participant['Nachname']);
        $statement->bindParam(3, $new_participant['Email']);
        $statement->bindParam(4, $new_participant['Straße']);
        $statement->bindParam(5, $new_participant['Hausnummer']);
        $statement->bindParam(6, $new_participant['PLZ']);
        $statement->bindParam(7, $new_participant['Ort']);
        $statement->bindParam(8, $new_participant['Land']);
        $statement->bindParam(9, $new_participant['Turnusaerztevertreter']);
        $statement->bindParam(10, $new_participant['DO_VM_WS_1']);
        $statement->bindParam(11, $new_participant['DO_NM_WS_1']);
        $statement->bindParam(12, $new_participant['FR_VM_WS1_1']);
        $statement->bindParam(13, $new_participant['FR_VM_WS2_1']);
        $statement->bindParam(14, $new_participant['FR_NM_WS_1']);
        $statement->bindParam(15, $new_participant['Kongresseroeffnung']);
        $statement->bindParam(16, $new_participant['Kongressparty']);
        $statement->bindParam(17, $new_participant['Infotext']);
        $statement->bindParam(18, $new_participant['Hassh']);

        $statement->execute();

        $statement = null;
        $db = null;

}
Dharman
  • 30,962
  • 25
  • 85
  • 135
Thomas
  • 1
  • just get rid of the two quoted dots (`" . "`) at then beginning of the INSERT statement. – Barbaros Özhan Sep 01 '19 at 08:52
  • `'Hassh'` maybe a typo? – digijay Sep 01 '19 at 08:56
  • That changed nothing, still working local, but not on the server. No, the Hassh was intended, since it was first shown blue in my editor and i thougt that is the problem. – Thomas Sep 01 '19 at 09:01
  • 1
    Possible duplicate of [My PDO Statement doesn't work](https://stackoverflow.com/questions/32648371/my-pdo-statement-doesnt-work) – Dharman Sep 01 '19 at 10:18
  • 1
    Put the `$statement->execute()` in a `try/catch` and then if it fails echo out the issue with `$error->getMessage()` in the `catch` part. – akaBase Sep 01 '19 at 10:23
  • The problem was the 'ß' in the statement/table.... – Thomas Sep 01 '19 at 17:43

0 Answers0