When testing an application of this sort, put values like this in every field:
<div style="background:red">It's Buggy</div>
If that isn't inserted correctly, you'll have errors. If it is inserted correctly and rendered as unescaped HTML you'll know immediately.
This applies to every single parameter that can come in via $_GET
or $_POST
.
Writing with mysql_query
is hazardous at the best of times, and downright reckless if you're not extremely careful. PDO works well with MySQL and doesn't take that long to learn if you follow a good tutorial.
You should be writing queries like this:
INSERT INTO users (name) VALUES (?)
The ?
is a data placeholder that you can safely bind against.
A better approach is to use something like Propel or Doctrine to provide a proper database layer. This makes your code much more readable and portable between MySQL and other databases.