Jump to content

Problem with CREATE TABLE IF NOT EXISTS


shamuraq

Recommended Posts

Hi guys,

I have been using the "CREATE TABLE IF NOT EXISTS" with no problem until today... It keeps on giving me error. So i logged in to my phpMyAdmin to test it out on the sql console and it responded with

#1064 - 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 '"CREATE TABLE IF NOT EXISTS `[email protected]` ( `id` INT( 7 ) NOT NULL AUTO_IN' at line 1

 

this is the syntax that i used on phpMyAdmin:

"CREATE TABLE IF NOT EXISTS `[email protected]` (
	`id` INT( 7 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
	`ref` VARCHAR ( 200 ) NOT NULL ,
	`date` VARCHAR(10) NOT NULL ,
	`time` VARCHAR(10) NOT NULL ,
	`action` TEXT  ,
	`score` VARCHAR(4),
	`credit_charge` INT( 4 ) NOT NULL ,
	) ENGINE = innodb;";

 

i referred to the error that phpMyAdmin returned (error #1064) and found out it highly likely the usage of reserved keyword (http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html). But i cannot find any reserved keyword that i could've used in my query so far...

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/254231-problem-with-create-table-if-not-exists/
Share on other sites

I once worked at a company that created a database for every user.... wow....

 

If you create a table for every user or in my case it was a database, every time you change the table/database you will need to change ALL of them, not just one, and if you forget to change one then the person that owns that table/database will get lots of errors, and you will have a mess on you hands.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.