I have select code like this:
mysql_query('
SELECT id, date, ip, page, get, referer
FROM iplog ORDER BY id DESC
');
My problem is, name of column called get causes error.
When I change column name in both here and in database, error is gone. Any ideas?
Use backquotes for reserved words (or names with characters like spaces):
SELECT id, date, ip, page, `get`, referer FROM iplog ORDER BY id DESC
get
is a reserved word in MySQL 5.7. The list is here. It starts appearing as a reserved word in MySQL 5.6.
One of these is probably a reserved word for your database. If you cannot detemrine which, nor want to, wrap each name in backticks like:
`date`
put the names in backticks like
`get`
Then your query will be look like:
mysql_query('
SELECT id, date, ip, page, `get`, referer
FROM iplog ORDER BY id DESC
');
because get is a keyword/reserve word in mysql