Hello everybody. I have a problem with an sql query and would be gratefull for some help.
I can't get this to work. I tried the INSERT command on the shell and it works just fine but here, it gives me the 1064 error which is a syntax error. To get things wirder, the first call to bindValue(), the one that binds ":table_name" and "korisnicki_podaci" works, but the subsequent don't.
Thank you in advance for any kind of help
private static $_sqlRegistration = "INSERT INTO :tableName(ime, prezime, nadimak, lozinka, mail, registracija)
VALUES(:name, :lastName, :username, :password, :e_mail, CURDATE())";
public static function userRegistration($conn)
{
try
{
$st = $conn->prepare(self::$_sqlRegistration);
$st->bindValue(":tableName", "korisnicki_podaci", PDO::PARAM_STR);
$st->bindValue(":name", "Marko", PDO::PARAM_STR);
$st->bindValue(":lastName", "Legenda", PDO::PARAM_STR);
$st->bindValue(":username", "Kreten", PDO::PARAM_STR);
$st->bindValue(":password", "digital", PDO::PARAM_STR);
$st->bindValue(":e_mail", "izmisljeni_mail@gmail.com", PDO::PARAM_STR);
$st->execute();
}
catch(PDOException $e)
{
throw new Exception("Statement not executed " . $e->getMessage());
}
}