Reputation: 33
How can i use my variable, which stores database table name in mysql query. Example:
$myTable = "customers";
$stmt = $this->db->prepare("INSERT INTO $myTable (smthg) VALUES ("value")");
I'm very new for mysql so sorry if this question is pretty stupid.
Upvotes: 0
Views: 55
Reputation: 2129
$stmt = $this->db->prepare("INSERT INTO $myTable (smthg) VALUES ('$mytable')");
Upvotes: 1