PHP/MYSQL Trouble Selecting by Primary Key

Posted by djs22 on Stack Overflow See other posts from Stack Overflow or by djs22
Published on 2010-05-28T08:23:50Z Indexed on 2010/05/28 8:31 UTC
Read the original article Hit count: 236

Filed under:
|
|

Hi all, So I have a primary key column called key. I'm trying to select the row with key = 1 via this code:

$query ="SELECT * FROM Bowlers WHERE key = '1'"; 
$result = mysql_query($query) or die(mysql_error());

For some reason, I'm getting this result:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = '1'' at line 1

The mysql statement works for using other keys, ie WHERE name = 'djs22'.

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql