1.) mysql is now deprecated use mysqli... from http://us2.php.net/manual/en/intro.mysql.php
This extension is deprecated as of PHP 5.5.0, and is not recommended
for writing new code as it will be removed in the future. Instead,
either the mysqli or PDO_MySQL extension should be used. See also the
MySQL API Overview for further help while choosing a MySQL API.
2.) Are you seriously setting $_GET data into your database?
3.) Are you seriously setting $_GET data into your database without escaping it? ALWAYS escape user provided data when putting it into your databse unless you enjoy getting hacked by Chinese government sponsored hackers (or Russian, or Netherlands, or Brazil... or lesser common countries, but those are the most common as far as I've been hack attempted)
See the docs for mysqli_real_escape_string
: http://us2.php.net/manual/en/mysqli.real-escape-string.php
2.) Where are you getting that INSERT
format from? In MySQL the format is:
INSERT INTO table_name VALUES (value1, value2, value3,...)
From: http://www.w3schools.com/php/php_mysql_insert.asp
Personally, I prefer the other INSERT format:
INSERT [LOW_PRIORITY |
DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name,...)]
SET col_name={expr | DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
4.) What is your table name? I see a DB name, and I THINK a column name, and then a value...
So I'd change your INSERT statement to this:
$value = mysqli_real_escape_string($_GET['param']);
$sql = 'INSERT INTO `table_name` SET `column`="'.$value.'";';
$result = mysqli_query($sql);