WHERE problems..
Moderator: General Moderators
WHERE problems..
My syntax:
"SELECT * FROM table WHERE to = news ORDER BY id LIMIT 0,15"
isn't working. If I delete the "WHERE to = news", then it works exactly how it's supposed to.
Any ideas?
"SELECT * FROM table WHERE to = news ORDER BY id LIMIT 0,15"
isn't working. If I delete the "WHERE to = news", then it works exactly how it's supposed to.
Any ideas?
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
I tried that, and it returned the same problem.mydimension wrote:use: WHERE to = 'news'
MySQL Query
Code: Select all
$result1 = mysql_query("SELECT * FROM pphp_news WHERE to = 'news' ORDER BY id DESC LIMIT 0,15",$connection) or die(mysql_error());Code: Select all
You have an error in your SQL syntax near 'to = 'news' ORDER BY id DESC LIMIT 0,15' at line 1- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Check this out:
http://www.mysql.com/doc/en/Reserved_words.html
to is a reserved word in MySQL and can't be used as a column name.
Mac
http://www.mysql.com/doc/en/Reserved_words.html
to is a reserved word in MySQL and can't be used as a column name.
Mac
