Need help.
I'm having hard time trying to update the database with PHP. It keeps on giving me "Unknown column in 'field list'" error. I have run the same command through PHPMyadmin and it is successfully updating the data.
Below is the table structure:
CREATE TABLE `user` (
`uid` int AUTO_INCREMENT NOT NULL,
`name` text,
`photo_localurl` text,
`birthday` text,
`nickname` text,
`height` text,
`lastupdate` timestamp,
PRIMARY KEY (`uid`)
) ENGINE = InnoDB;
if I insert with back-tick in column name
$sql = "UPDATE user SET `height` = '$height' WHERE uid = '$uid'";
i get this error
UPDATE user SET `height` = '6\' 2"/|!-!|/1.88 m' WHERE uid = '51' Unknown column 'height' in 'field list'
if i insert without back-tick
$sql = "UPDATE user SET height = '$height' WHERE uid = '$uid'";
I get this error
UPDATE user SET height = '6\' 2"/|!-!|/1.88 m' WHERE uid = '51' Unknown column 'height' in 'field list'
if I use single tick
$sql = "UPDATE user SET 'height' = $height WHERE uid = $uid";
I get this error
UPDATE user SET 'height' = 6\' 2"/|!-!|/1.88 m WHERE uid = 51 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 ''height' = 6\' 2"/|!-!|/1.88 m WHERE uid = 51' at line 1
user? It's not a reserved keyword in MySQL I think, but it is in some other SQL based systems, can't hurt to try anyway :)show create table user;is like your create table statement.