Page 1 of 1

sample code to create new table fails

PostPosted: 02. February 2017 23:03
by richb201
I am using the book PHP Application Development with NetBeans. The following sample code appears in the book. I typed it EXACTLY.

CREATE TABLE 'status' (
'id' bigint(20) NOT NULL AUTO_INCREMENT,
'name' varchar(50) NOT NULL,
'image' varchar(100) NOT NULL,
'status' varchar(500) NOT NULL,
'timestamp' int(11) unsigned NOT NULL,
PRIMARY KEY ('id')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

When I run it I get:
[Warning, Error code 1,064, SQLState 42000] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''status' (
'id' bigint(20) NOT NULL AUTO_INCREMENT,
'name' varchar(50) NOT NULL,' at line 1

I am running XAMPP v3.2.2 . I don't know how to check MariaDB since XAMPP shows MySQL running. I don't know how to check the version anyway. Any idea?

Re: sample code to create new table fails

PostPosted: 02. February 2017 23:47
by Nobbie
You typed the wrong quotes. Instead of simple single quotes you have to use backticks. Like `status`

Re: sample code to create new table fails

PostPosted: 02. February 2017 23:50
by richb201
That was it. I never would have figured that out! THX