h2O
h2O

Reputation: 544

Create a table with a space in the name

I want to create a table in MySQL with the name "123 Product", with numbers at the beginning and a space in between. I can do this using phpMyAdmin but I want to make this table using PHP. But, unfortunately, I am unable to do this.

Upvotes: 7

Views: 10946

Answers (1)

user1646111
user1646111

Reputation:

You can simply try this: enclose table name with backticks (`)

CREATE TABLE `123 Product` 
(
`product_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 
`product_name` VARCHAR(255) NOT NULL
 ) 
ENGINE = InnoDB;

Upvotes: 16

Related Questions