So, I’m not exactly sure what the problem is, but, when I try to INSERT into a table, it doesn’t work.
All the variables are working. I’ve echoed and tested them, they are working.
$username = $_SESSION['username'];
$update = $_GET['update'];
mysql_query("INSERT INTO updates (username, update) VALUES ('$username', '$update')");
So it must be a problem with my mySQL query. This mySQL query is one of two in the .php folder. If that makes any difference.
Error in SQL
There is an error in your SQL. You cannot use MySQL keywords in column names without quoting them.
In this case
updateneeds to be enclosed in backticks:SQL injection
Your code is susceptible to SQL injection attacks. You should escape quoted strings that are placed into an SQL statement with
mysql_real_escape_string()or bind your data using PHP PDO prepared statements.Putting it together
I have written little SQLFiddle for you so you can see this in action: http://sqlfiddle.com/#!2/c25b1/1