Ad

Php Issue With Inserting Into Sql

- 1 answer

I am having an issue inserting into mysql db using php. specifically this code is giving me problems:

$sql = "INSERT INTO '$mysql_database'.'$UsersTable' ('firstName', 'lastName', 'password', 'email','userType')VALUES ('$firstName', '$lastName', '$password','$email','$userType')";

I can't seem to find the error with syntax here. All the information to me seems correct. where am I going wrong ?

Ad

Answer

try this

$sql = "INSERT INTO $mysql_database.$UsersTable (firstName, lastName, password, email,userType)VALUES ('$firstName', '$lastName', '$password','$email','$userType')";

remove Quote from table column

Ad
source: stackoverflow.com
Ad