sample code to create new table fails

Problems with the Windows version of XAMPP, questions, comments, and anything related.

sample code to create new table fails

Postby richb201 » 02. February 2017 23:03

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?
richb201
 
Posts: 7
Joined: 18. December 2016 18:15
XAMPP version: 3.2.2
Operating System: win 7

Re: sample code to create new table fails

Postby Nobbie » 02. February 2017 23:47

You typed the wrong quotes. Instead of simple single quotes you have to use backticks. Like `status`
Nobbie
 
Posts: 9628
Joined: 09. March 2008 13:04

Re: sample code to create new table fails

Postby richb201 » 02. February 2017 23:50

That was it. I never would have figured that out! THX
richb201
 
Posts: 7
Joined: 18. December 2016 18:15
XAMPP version: 3.2.2
Operating System: win 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests