but really if you' ve got a syntax error in your SQL or something that bad,. you might as well. You haven' t quoted your query. You should quote every field like this. INSERT INTO data ( name, name1, name2, name3) VALUES( ' $ name',. Step 2 — Writing PHP code to INSERT data into MySQL database. There is a syntax error which unfortunately, caused our script to fail. Returns a string containing the error message for the most recently invoked. Procedural style only: A statement identifier returned by mysqli_ stmt_ init( ). Return the last error description for the most recent function call, if any: