JQuery POST to PHP not working "Unknown column"?
Go to solution
Solved by C2dan88,
The values in your sql query need to wrapped in quotes otherwise mysql will think the text based values you are inserting are referring to other sql syntax, ie column names hence the sql error
$query= "INSERT INTO `removedname`(`id`, `meta_title`, `meta_description`, `site_url`, `platform`) VALUES ($id,'$meta_title','$meta_description','$site_url','null')";
That wll fix your error. But you should not be placing variables into a sql query like that without first sanitizing it to make safe to use in your query. Otherwise your code will be easily hackable with sql injections
https://phpdelusions.net/sql_injection
A better way of running sql queries is prepared queries.
https://phpdelusions.net/mysqli_examples/insert
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now